第九周ppt作业,根据分数判定等级

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();


}
}

posted @ 2015-11-14 15:54  键盘已坏  阅读(124)  评论(0编辑  收藏  举报