import java.util.Scanner; // 输入10位学生的成绩,并且判断他们的成绩是哪个等级,其中90-100是A级,80-89是B级,70-79是C级,60-69是D级,60分以下E级 public class App1 { public static void main(String[] args) { double[] scores = new double[10]; Scanner scanner = new Scanner(System.in); // 读取键盘输入并且赋值给scores数组元素 for (int i = 0; i < 10; i++) { System.out.println("请输入第" + i + "位学生的成绩"); scores[i] = scanner.nextDouble(); } for (int j = 0; j < 10; j++) { double temp = scores[j]; if (temp >= 90 && temp <= 100) { System.out.println(j + "是A"); } else if (temp >= 80 && temp < 90) { System.out.println(j + "是B"); } else if (temp >= 70 && temp < 80) { System.out.println(j + "是C"); } else if (temp >= 60 && temp < 70) { System.out.println(j + "是D"); } else { System.out.println(j + "是E"); } } } }