Pet and Inheritance FRQ.pdf - FRQ about Inheritance Create...

This preview shows page 1 - 2 out of 2 pages.

FRQ about Inheritance Create a class called Dog including implementations of the constructor and a method called speak that returns the String containing a dog-sound. Create a class called LoudDog including implementations of the constructor and a method called speak that overrides the speak method in the Dog class but returns a String containing the dog-sound repeated twice.
FRQ about Inheritance public class Kenner { // already declared and instantiated private ArrayList<Pet> petList; /* Constructor not shown public void allSpeak() { /* to be implemented */ } } Write the Kennel method allSpeak. For each pet in the kennel, allSpeak prints a line with the name of the Pet followed by the result of a call to its speak method.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture