源代码:
import java.util.Scanner;
public class Score {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
String s;
System.out.println("请输入课程成绩:");
s = input.nextLine();
try{
int i = Integer.valueOf(s);
if( i<60&& i>=0)
System.out.println("该成绩不及格");
if( i>=60&& i<70)
System.out.println("该成绩及格");
if (i>=70&& i<80)
System.out.println("该成绩中等");
if( i>=80&& i<90)
System.out.println("该成绩良好");
if( i>90&&i<=100)
System.out.println("该成绩优秀");
}
catch(Exception e){
System.out.println("输入错误");
}
}
}
结果截图: