java.lang.Object GradeCalculator
public class GradeCalculator
Class that calculates the average of a collection of grades, possibly dropping the lowest grade.
Constructor Summary | |
---|---|
GradeCalculator()
Constructor for objects of class GradeCalculator. |
Method Summary | |
---|---|
void |
enterGrade(int nextGrade)
Enters a grade and updates the totals accordingly. |
double |
getAverage()
Determines the average of the grades entered so far. |
java.lang.String |
getLetterGrade()
Determines the letter grade earned by the current grades entered. |
int |
getLowestGrade()
Accessor method for the lowest grade. |
int |
getNumberOfGrades()
Accessor method for the number of grades. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GradeCalculator()
Method Detail |
---|
public void enterGrade(int nextGrade)
nextGrade
- the grade to be entered (it is assumed that grades are in the range 0 to 100)public double getAverage()
public java.lang.String getLetterGrade()
public int getLowestGrade()
public int getNumberOfGrades()