Class Student

java.lang.Object
  extended by Student

public class Student
extends java.lang.Object

A class for managing the grades of a student


Constructor Summary
Student()
          Constructor for creating an anonymous student
Student(java.lang.String name)
          Constructor for creating a student with the given name
 
Method Summary
 void addGrade(double newGrade)
          Method to add a new grade at the end of the grade list
 double average()
          Method to return the average of the student's grades
 double getGrade(int whichScore)
          Method to fetch the indicated score for the student
 int getNumScores()
          Method to fetch the number of scores entered for the student
 void setGrade(int whichScore, double grade)
          Method to set the indicated score for the student
 java.lang.String toString()
          Override toString for the Student class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Student

public Student()
Constructor for creating an anonymous student


Student

public Student(java.lang.String name)
Constructor for creating a student with the given name

Parameters:
name - the name for the new student
Method Detail

toString

public java.lang.String toString()
Override toString for the Student class

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the student

addGrade

public void addGrade(double newGrade)
              throws GradeException
Method to add a new grade at the end of the grade list

Parameters:
newGrade - the grade to add
Throws:
GradeException - if grades array is full

getNumScores

public int getNumScores()
Method to fetch the number of scores entered for the student

Returns:
the number of scores

average

public double average()
Method to return the average of the student's grades

Returns:
the average of the grades

getGrade

public double getGrade(int whichScore)
                throws GradeException
Method to fetch the indicated score for the student

Parameters:
whichScore, - the number of the score to fetch
Throws:
GradeException - if whichScore is out of range

setGrade

public void setGrade(int whichScore,
                     double grade)
              throws GradeException
Method to set the indicated score for the student

Parameters:
whichScore, - the number of the score to set
grade - the value to which to set the score
Throws:
GradeException - if whichScore is out of range