ScaleGrades

ScaleGrades - grades[place] = IO.readInt( ); while...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// this program reads set of grades until a sentinal of 0 // it prints the grades divided by the maximum grade in the input public class ScaleGrades{ public static void main(String[ ] args){ int[ ] grades = new int[10]; int place=0; int maxGrade = 0; double dmax; // Read grades and find max
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: grades[place] = IO.readInt( ); while (grades[place]>0){ if (grades[place]>maxGrade){ maxGrade = grades[place]; } place++; grades[place] = IO.readInt( ); } dmax = maxGrade; //print scaled grades for (int i=0; i<place; i++){ System.out.println(grades[i]/dmax); } } }...
View Full Document

Ask a homework question - tutors are online