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 10:30
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
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 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
You know the right answer?
Define a method printall() for class petdata that prints output as follows. hint: make use of the b...
Questions
Questions on the website: 13722359