Question: Java code that is required for the OOP course Consider a system with a number of different types of Animals. In your system, Animal will

Java code that is required for the OOP course

Consider a system with a number of different types of Animals. In your system, Animal will be an abstract superclass, while Cow and Lion are subclasses.

Animal class contains certain fields, such as 'age', 'height' and 'weight' for the animals. Also, animal provides move and eat functionalities that the subclasses will utilize. These methods have no definition in Animal.

Cow and Lion override 'eat' and 'move' methods and define how they eat or move. You can consider printing some relevant statements in each method.

In your main, create an ArrayList of Animals that you use to assign a cow and two lions in. Receive their data through a Scanner from the user. Make sure you handle exceptions regarding possible input mismatch. After this use a for-each loop to print the animal information and make them move and eat.

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!