Computers and Technology

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:


// 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 ();
userpet. printall();
system. out. println("");

return;
}
}
// end

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:00, edjiejwi
Lisa has a section of her document that she would like to include in the index. which option should lisa choose? mark index mark entry insert endnote add text
Answers: 3
image
Computers and Technology, 22.06.2019 09:40, vanessacasillas452
In the lab, which of the following displayed a list of all installed services and included a description of the service, the current state, and whether the service started automatically or manually? a. the services manager b. the applications summary c. the recommended services d. list the safe services list
Answers: 2
image
Computers and Technology, 22.06.2019 18:30, dpinzoner5952
Which of the following commands is more recommended while creating a bot?
Answers: 1
image
Computers and Technology, 23.06.2019 22:20, kandi2565
What is a programming method that provides for interactive modules to a website?
Answers: 1
Do you know the correct answer?
Define a method printall() for class petdata that prints output as follows. hint: make use of the b...

Questions in other subjects: