Pet information (derived classes) The base class Pet has private fields petName, and petAge. The derived class
Fantastic news! We've Found the answer you've been seeking!
Question:
Pet information (derived classes) The base class Pet has private fields petName, and petAge. The derived class Dog extends the Pet class and includes a private field for dogBreed. Complete the main() to:
- create a generic pet and print information using printInfo().
- create a dog pet, use printInfo() to print information, and add a statement to print the dog's breed using the getBreed() method.
Ex. If input is:
Dobby2Kreacher3German Schnauzer
the output is:
Pet Information: Name: Dobby Age: 2Pet Information: Name: Kreacher Age: 3 Breed: German Schnauzer
Related Book For
Posted Date: