1 import java.util.Scanner; 2 /** 3 * @author 冰樱梦 4 * 时间:2018年下半年 5 * 题目:指定等级 6 * 7 */ 8 public class Exercise07_01 { 9 public static void main(String[] args){ 10 int score[]=new int[100]; 11 Scanner input = new Scanner(System.in); 12 System.out.println("Enter the number of students: "); 13 int students=input.nextInt(); 14 System.out.println("Enter " + students +" scores: "); 15 int best=0; 16 for(int i=0;i<students;i++){ 17 score[i]=input.nextInt(); 18 if(score[i]>best){ 19 best=score[i]; 20 } 21 } 22 for(int i=0;i<students;i++){ 23 if(score[i]>=best-10){ 24 System.out.println("Student " + i +" scores is " + score[i] + " and grade is A"); 25 } 26 else if(score[i]>=best-20){ 27 System.out.println("Student " + i +" scores is " + score[i] + " and grade is B"); 28 } 29 else if(score[i]>=best-30){ 30 System.out.println("Student " + i +" scores is " + score[i] + " and grade is C"); 31 } 32 else if(score[i]>=best-40){ 33 System.out.println("Student " + i +" scores is " + score[i] + " and grade is D"); 34 } 35 else{ 36 System.out.println("Student " + i +" scores is " + score[i] + " and grade is F"); 37 } 38 } 39 40 } 41 }