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

= 8.75-0.5 Read the following class definitions, and then answer the questions t

ID: 3882216 • Letter: #

Question

= 8.75-0.5 Read the following class definitions, and then answer the questions that follow: public enum type0fDiet f > CARNIVORE, HERBIVORE OMNIVORE public interface Pet f public String who0wnsMeO; public String whatIsMyName); public void changeName (String newName); public class mammal protected boolean hasATail; public int numOfLegs; public type0fDiet eats; public mammal(boolean tail, int legs, typeOfDiet eats)f hasATail tail; nunOfLegs = legs; this.eats = eats; import java.util.Scanner; public class Dog extends mammal ( public boolean hasAnOwner; private String ownerName; private String name; private String breed; public Dog(String breed, boolean tail, int legs, typeOfDiet eats, boolea hasAnOwner, String name, String ownerName) super(tail, legs, eats); this.breed = breed; this. hasAnOwner hasAnOwner;

Explanation / Answer

6)  Mammal and dog both are related by inheritance
Here the class dog extending the states and behaviours of mammal.

7) public String whoOwnsMe() ;

public String whatIsMyName() ;

public void changeName(String newName) ;

8) That technique is called constructor overloading. As long as constructor signature not same we can define multiple constructors
This technique is known as Constructor overloading, Means same function name with diff arguments list.

9) Mammal downloki=(mammal)loki
For loki from dog to mammal type casting won't be possible

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