我已经在这里查看了所有其他类似的主题,我仍然无法弄清楚为什么我的程序只打印A或A-无论如何。请解释我做错了什么以及如何改变它。谢谢!
import static java.lang.System.*;
import java.util.Scanner;
public class Grading
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int grade;
out.println("Please enter your grade to be evaluated: ");
grade = sc.nextInt();
if(grade >= 93)
out.println("A");
else if(grade >= 90 && grade <= 92)
out.println("A-");
else if(grade >= 87 && grade <= 89)
out.println("B+");
else if(grade >= 83 && grade <= 86)
out.println("B");
else if(grade >= 80 && grade <= 82)
out.println("B-");
else if(grade >= 77 && grade <= 79)
out.println("C+");
else if(grade > =73 && grade <= 76)
out.println("C");
else if(grade >= 70 && grade <= 72)
out.println("C-");
else if(grade >= 67 && grade <= 69)
out.println("D+");
else if(grade >= 63 && grade <= 66)
out.println("D");
else if(grade >= 60 && grade <= 62)
out.println("D-");
else if(grade < 60)
out.println("F");
}
}
答案 0 :(得分:2)
你的程序运行正常。只需改变
else if(grade > =73 && grade <= 76)
到
else if(grade >=73 && grade <= 76)