Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A) What are all the instance methods( , give method signature->access modifier,

ID: 3735660 • Letter: A

Question

A) What are all the instance methods( , give method signature->access modifier, return type, name, parameters of each, ) in the Animal class ?

B) What are all the instance methods ( , give method signature-access modifier, return type, name, parameters of each, ) that describes the Pet class ? Include inherited methods as well.

C) What are all the instance methods ( , give method signature-access modifier, return type, name, parameters of each, ) that describes the Cat class ? Include inherited methods as well.

public classl Animal private int legs: private boolean hasBrain true: private String eat: public void eat) system.out.printin("Eats food !"); ) public void sleep System.out.print ("Animal sleeps!"):

Explanation / Answer

a)

Instance methods of Animal class:

public void eat();

public void sleep();

b)

Instance methods of Pet class:

public void sleep();

public void eat(String food);

public void eat(); // inherited from Animal class

c)

Instance methods of Cat class:

public void meow();

public sleep(String cat);

public void sleep(); // inherited from Pet class

public void eat(String food); // inherited from Pe

public void eat(); // inherited from Anim

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote