import java.util.Scanner;public class Test{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入分数:");
double score = scanner.nextDouble();
scanner.close();
if (score < 0 || score > 100) {
System.out.println("输入的分数不在0-100之间,不符合要求");
} else if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
} else if (score >= 60) {
System.out.println("C");
} else {
System.out.println("D");
}
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("请输入分数:");
double score = scanner.nextDouble();
scanner.close();
if (score < 0 || score > 100) {
System.out.println("输入的分数不在0-100之间,不符合要求");
} else if (score >= 90) {
System.out.println("A");
} else if (score >= 80) {
System.out.println("B");
} else if (score >= 60) {
System.out.println("C");
} else {
System.out.println("D");
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货