subject

Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. 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;
}
public void setAge(int numYears) {
ageYears = numYears;
}
// Other parts omitted
public void printAll() {
System. out. print("Name: " + fullName);
System. out. print(", Age: " + ageYears);
}
}
// end
// Code from file PetData. java
public class PetData extends AnimalData {
private int idNum;
public void setID(int petID) {
idNum = petID;
}
// FIXME: Add printAll() member function
/* Your solution goes here */
}
// end
// Code from file BasicDerivedOverride. java
import java. util. Scanner;
public class BasicDerivedOverride {
public static void main(String[] args) {
Scanner scnr = new Scanner(System. in);
PetData userPet = new PetData();
String userName;
int userAge;
int userID;
userName = scnr. next();
userAge = scnr. nextInt();
userID = scnr. nextInt();
userPet. setName(userName);
userPet. setAge (userAge);
userPet. setID (userID);
userPet. printAll();
System. out. println("");
}
}
// end

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:30
To remove a header or footer from a document you can open the header and footer and manually delete the content true or false
Answers: 1
question
Computers and Technology, 22.06.2019 05:30
Agood flowchart alludes to both the inputs and outputs you will need to receive and give to the user. true or false?
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
A911 dispatcher is the sole sender of messages to all police officers. while on patrol, officers communicate with the dispatcher who, in turn, relays messages to other officers. the officers do not communicate directly with one another. this illustrates a network.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
You know the right answer?
Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5,...
Questions
question
World Languages, 12.10.2019 15:50
question
Mathematics, 12.10.2019 15:50
Questions on the website: 13722363