// intro to arrays // better way of processing grades input by user! public class array_better { public static void main(String[] args) { int grade = SavitchIn.readLineInt(); // should reprompt user to prevent out-of-bounds grade! // want code to count frequency of grades from input int[] counts = new int[101]; // counts go from 0 to 100 // could define named constant N instead of 101 to make // code more general while (grade >= 0) { counts[grade]++; grade = SavitchIn.readLineInt(); } for(int i=0; i < counts.length ; i++) System.out.println("Grade "+i+": " + counts[i]); } }