import java.util.Scanner;
public class F {
public class F {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner in=new Scanner(System.in);
int a;
a=in.nextInt();
String result=getGrade(a);//调用函数
System.out.println("对应等级为:"+result);
}
public static String getGrade(int score){
String grade="";//用于储存对应的等级
if(score>=90&&score<=100){
grade="A";
}else if(score>=80&&score<=89){
grade="B";
}else if(score>=70&&score<=79){
grade="C";
}else if(score>=60&&score<=69){
grade="D";
}else if(score>=0&&score<=59){
grade="E";
}return grade;//把分数等级还给调用者
}
}
// TODO 自动生成的方法存根
Scanner in=new Scanner(System.in);
int a;
a=in.nextInt();
String result=getGrade(a);//调用函数
System.out.println("对应等级为:"+result);
}
public static String getGrade(int score){
String grade="";//用于储存对应的等级
if(score>=90&&score<=100){
grade="A";
}else if(score>=80&&score<=89){
grade="B";
}else if(score>=70&&score<=79){
grade="C";
}else if(score>=60&&score<=69){
grade="D";
}else if(score>=0&&score<=59){
grade="E";
}return grade;//把分数等级还给调用者
}
}
来源:oschina
链接:https://my.oschina.net/u/4399002/blog/3590073