In the GradeCalculator.java program the user clicks the Enter button.
The first input is a JOptionPane that asks the user, ¡§Number of score to be entered?¡¨
scoreAmount = JOptionPane.showInputDialog("Number of scores to be entered?");
numberOfScores = Integer.parseInt(scoreAmount);
When the OK button is clicked another JOptionPane opens asking the user to enter a score (integer) and the JOptionPane will be repeated depending in the value entered for the ¡§Number of score to be entered¡¨ (for loop).
The values entered are stored in an accumulator:
accumulatorVariable += scoreVariable
The += adds the current value of the scoreVariable to the value already stored in the accumulatorVariable.
When the last number is entered (end of for loop) a method calls calculateAverage();
The calculateAverage method determines the letter score using the ¡¥if block¡¦:
„h averageScore > 89, letter score is A
„h averageScore > 79, letter score is B
„h averageScore > 69, letter score is C
„h averageScore > 64, letter score is D
„h when the averageScore values is below 64 the default letter score is an F
Specifications:
„h All variable names use two or more words naming convention
„h Method calls and methods MUST be used
„h Window size is 400 x 400