OK below is the prompt I got for this homework assignment. I have been able to write almost all of it but I cant figure out the last bit.
Prompt-
"The Person class has a print method that writes a person's name and age to the console. Thus, if we created a Person object with these values:
Person p = new Person("Buster", 22);
the call:
p.print();
would result in the following output to the console:
Name: Buster
Age: 22
We want to provide similar printed information information for objects in the subclass CollegeKid. Remember that CollegeKid objects contain the additional datum gpa. If we created a CollegeKid object with these values:
CollegeKid k = new CollegeKid("Zoe", 23, 3.75);
the call:
k.print();
should result in the following output to the console:
Name: Zoe
Age: 23
GPA: 3.75
For this exercise, enter code in the box below that will allow the print method in the CollegeKid class to override print in the Person class, and thus write the above specified output to the console. Note that your output must have the same format as in the example above."
public class CollegeKid extends Person { private double gpa; public double getGPA () { return gpa; } public void setGPA (double g) { gpa = g; } public void print ( ) { This is what im missing } }