import java.util.Scanner;
class Scored{
int scored;
void get(){
Scanner sc=new Scanner(System.in);
try{
System.out.println("请输入0到100间的整数");
scored=sc.nextInt();
}
catch(Exception e){
System.out.println("请重输");
get();
}
}
void show(){
if(scored<60&&scored>=0) System.out.println("不及格");
else if(scored>=60&&scored<70) System.out.println("及格");
else if(scored>=70&&scored<80) System.out.println("中");
else if(scored>=80&&scored<90) System.out.println("良");
else if(scored>=90&&scored<=100) System.out.println("优");
else {System.out.println("请重输");
get();show();}
}
}
public class Performance {
public static void main(String Args[]){
Scored sco=new Scored();
sco.get();
sco.show();
}
}
时间: 2024-10-06 02:11:08