答:
int a = 0;
if (a<0 || a>100) {
System.out.println("成绩输入错误,请重试");
}else if (a>=90) {
System.outprintln("A等");
}else if (a>=80) {
System.outprintln("B等");
}else if (a>=70) {
System.outprintln("C等");
}else if (a>=60) {
System.outprintln("D等");
}else {
System.outprintln("E等");
}
Scanner sc = new Scanner(System.in);
System.out.println("请输入成绩:");
int a = sc.nextInt();
if (a>100 || a<0) {
System.out.println("成绩输入错误,请重试");
}else {
int b = a / 10;
switch (b) {
case 10:
case 9:
System.out.println("A等");
break;
case 8:
System.out.println("B等");
break;
case 7:
System.out.println("C等");
break;
case 6:
System.out.println("D等");
break;
default :
System.out.println("E等");
break;
}
}作者: Glc90 时间: 2015-8-25 19:27
好吧 韩凯 到这里来学习了 作者: 韩凯5354 时间: 2015-8-25 19:55