PPT Slide
Program to print “histogram” of grades
// Read in a list of grades in the range 0..100, preceded
// by the number of grades, and
// print out how many times each grade appears
public static void main (String arg[]) {
TokenReader in = new TokenReader(System.in);
int n= in.readInt(); // number of grades
int[ ] f= new int [101]; // f[i] will contain the no.
// of times grade f appears
// Initialize frequencies f[k] to 0.
// Inv: Each element of f[0..k-1] is 0
(continued on next slide)