Question: Modify the Cat class to inherit the data fields and methods from the Animal class Add a speak method that prints Meow to the console

Modify the Cat class to inherit the data fields and methods from the Animal class
Add a "speak" method that prints "Meow" to the console/screen.
Create a Bird class that inherits the data fields and methods from the Animal class
This class should have an "altitude" property, corresponding to how high the bird is flying
Add a "speak" method that prints "Tweet tweet" to the console/screen.
Create a Main class
The main class should contain the main method that creates a cat and bird object, sets the various properties related to each, and calls the speak method for each object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!