/** * A student is a person with a gpa * @author CSC 142 */ public class Student extends Person{ private double gpa; /** * Creates a student given the name, age and gpa * @param name the name of the student * @param age the age of the student * @param gpa the gpa of the student */ public Student(String name, int age, double gpa) { // create the person part of the student // how? use the keyword super that calls the // superclass constructor // the super call MUST be the first line of code // in the constructor super(name, age); this.gpa = gpa; } /** * Prints the name, age and gpa of the student */ public void speak() { // override the speak method inherited from Person super.speak(); // calls speak in the Person class System.out.println("gpa = " + gpa); } }