天天看點

一個java小作業

import java.io.*;
import java.lang.*;
public class MyScore {
	public static void main(String args[])throws IOException  {
		double score=59;
		String str,s="成績為:";
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		System.out.print("輸入成績:");//輸出提示資訊
		str=br.readLine();//BufferedReader類的readLine方法接收鍵盤輸入的字元串
		score=Double.parseDouble(str);
		if(score>=90)
			System.out.println(s+"優秀!");
		else if(score>=80&&score<90)
			System.out.println(s+"良好!");
		else if(score>=70&&score<80)
			System.out.println(s+"中!");
		else if(score>=60&&score<70)
			System.out.println(s+"及格!");
		else 
			System.out.println(s+"不及格!");
	}
}

			
           

繼續閱讀