subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
Elements such as fonts colors visual structure graphics and the interface of a web page should complement each other to ensure blank
Answers: 3
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select โ€œstateโ€ under field name, then type in the state name under โ€œequal toโ€
Answers: 2
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
You know the right answer?
Define a method printall() for class petdata that prints output as follows. hint: make use of the b...
Questions
question
Mathematics, 02.03.2021 03:20
question
Mathematics, 02.03.2021 03:20
Questions on the website: 13722360