import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner x = new Scanner(System.in);
System.out.println("请输入成绩");
int a=x.nextInt();
int n=a/10; //百分制转换为等第
switch(n){
case 10: //表示如果n=10,也就是一百分,输出A
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;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
System.out.println("FAIL"); //低于六十分的输出不及格 FAIL
break;
default:System.out.println(" 请输入一个正确的成绩"); //输入的不是百分制,报错
}
}
}
水平有限,只能这样了
public static void maybe (){
Scanner input = new Scanner(System.in);
System.out.println("请输入成绩:");
int score=input.nextInt();
if(score>=0&&score<=100)
{
switch(score/10) {
case 10:
System.out.println("优秀");
break;
case 9:
System.out.println("优秀");
break;
case 8:
System.out.println("良好");
break;
case 7:
System.out.println("中等");
break;
case 6:
System.out.println("及格");
break;
default:
System.out.println("数据错误!");
break;
}
}
else{
System.out.println("数据错误!");
}
}
越王勾践 卧薪尝胆 百二奏关终属楚