Define a method printAll() for class PetData that prints output as follows. Hint: Make use of the base class' printAll() method.Name: Fluffy, Age: 5, ID: 4444
// ===== Code from file AnimalData.java =====
public class AnimalData {
private int ageYears;
private String fullName;
public void setName(String givenName) {
fullName = givenName;
return;
}
public void setAge(int numYears) {
ageYears = numYears;
return;
}
// Other parts omitted
public void printAll() {
System.out.print("Name: " + fullName);
System.out.print(", Age: " + ageYears);
return;
}
}
// ===== end =====
// ===== Code from file PetData.java =====
public class PetData extends AnimalData {
private int idNum;
public void setID(int petID) {
idNum = petID;
return;
}
// FIXME: Add printAll() member function
/* Your solution goes here */
}
// ===== end =====
// ===== Code from file BasicDerivedOverride.java =====
public class BasicDerivedOverride {
public static void main (String [] args) {
PetData userPet = new PetData();
userPet.setName("Fluffy");
userPet.setAge (5);
userPet.setID (4444);
userPet.printAll();
System.out.println("");
return;
}
}
// ===== end =====