import java.util.Scanner; //导包
class ScoreDemo
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);//创建对象,提示从键盘输入
System.out.println("请输入分数:");
int score = sc.nextInt();//调用从键盘输入的数
String lever;
if (score >= 90 && score <= 100)
{
lever = "A等";
}
else if (score >= 80 && score < 90)
{
lever = "B等";
}
else if (score >= 70 && score < 80)
{
lever = "C等";
}
else if (score >= 60 && score < 70)
{
lever = "D等";
}
else if (score >= 0 && score < 60)
{
lever = "E等";
}
else
{
lever = "成绩输入错误";
}
System.out.println(score+"分是"+lever);
}
}
|
-
错误.jpg
(25.96 KB, 下载次数: 5)
编译后出现的错误
|