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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started