Help with this code please.. im not sure how to go about this.
This exercise depends on these two classes:
/JavaCS1/src/inheritanceI/Person.java
/JavaCS1/src/inheritanceI/Oldie.java
The Person class has a print method that writes a person's name and age to the console. Thus, if we create a Person object with these values:
Person p = new Person("Buster", 22);
then the call:
p.print();
will write the following output to the console:
Name: Buster
Age: 22
In the same manner, we want to print information about objects in the subclass Oldie. Remember that Oldie objects contain the additional boolean datum perryComoFan. If we create an Oldie object with these values:
Oldie k = new Oldie("Cornelius", 93, true);
then the call: k.print(); should result in the following output to the console:
Name: Cornelius
Age: 93
Perry Fan: true
For this exercise, enter code in the box below that will allow the print method in the Oldie class to write the above specified output to the console. Note that your output must have the same format as that given in the example above.
public class Oldie extends Person { private boolean perryComoFan; public boolean isPerryComoFan () { return perryComoFan; } public void setPerryComoFan (boolean f) { perryComoFan = f; } public void print () {