Question: Write a Java code The purpose of this programming assignment is to show the polymorphic behavior of the methods in the super-class Animal in its

Write a Java code

The purpose of this programming assignment is to show the polymorphic behavior of the methods in the super-class Animal in its 3 sub-classes: Fish, Bird and Dog.

Superclass Animal should have 2 attributes and 2 methods:

Attributes:

Number_Legs of type int

is_Mammal of type boolean

Methods:

move(): Prints a relevant message corresponding to each class.

eat(): Prints a relevant message corresponding to each class.

Your sub-classes should override the constructor and the methods of class Animal.

You'll need to submit as a zipped folder as an attachment to this question that includes:

- 4 classes: Animal.java, Dog.java, Bird.java, Fish.java

- A main function where you test your program that creates objects from each class and prints the output.

- A screenshot of the output.

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 Databases Questions!