1 import java.util.*; 2 public class TextScore { 3 public static void main(String args[ ]) { 4 int score; 5 char grade; 6 Scanner reader=new Scanner(System.in); 7 System.out.print("请输入成绩(0~100):"); 8 int x=reader.nextInt(); 9 score=x; 10 if(score>=90) { 11 grade='A'; 12 } 13 else if(score>=80) { 14 grade='B'; 15 } 16 else if(score>=70) { 17 grade='C'; 18 } 19 else if(score>60) { 20 grade='D'; 21 } 22 else { 23 grade='E'; 24 } 25 System.out.print("评定成绩为:"+grade); 26 } 27 }
刚开始好几个地方输得的不对,改了好几次,写完之后真的很NICE,有一点小小的成就感!加油!朝着程序员的路前进!!!