I dont know how to complete this code?
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.
"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);
would result in the following output to the console:
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);
should result in the following output to the console:
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 ()
public void setGPA (double g)
gpa = g;
public void print ( )
This is what im missing
Re: I dont know how to complete this code?
How did you code the print() method in the Person class?
What needs to be added to the ouput for the CollegeKid class?
Start by copying the code from the Person class then modify it for the new requirements.