/**
 * A Student is a Person with a GPA.
 *
 * @author Zach Tomaszewski
 * @version 31 Mar 2008
 */
public class Student extends Person {

  private double gpa;

  /** Constructs a new Person with the given details */
  public Student(String name, int yob, double gpa) {
    super(name, yob);  //pass these to the Person constructor
    this.setGPA(gpa);
  }

  public double getGPA() {
    return this.gpa;
  }

  public void setGPA(double gpa) {
    //XXX: should really be checking that gpa > 0 && < 4.0 here...
    //This is the sort of place you would throw an exception.
    this.gpa = gpa;
  }

  /**
   * Returns a String of the form:
   * <i>name</i> (Born: <i>yob</i>, GPA: <i>GPA</i>)
   */
  public String toString() {
    //overriding Person's toString in order to include GPA
    String result = this.getName();
    result += "(Born: " + this.getYearOfBirth() + ", ";
    result += "GPA: " + this.getGPA() + ")";
    return result;
  }

}
