Question: Solve this Java problem ? We want to develop an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig. The base class contains the
Solve this Java problem ?
We want to develop an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig. The base class contains the methods that are common to all rodents based on behaviours found with a quick Internet search (such as eat, sleep, groom, move, etc.). Each behaviour should print the action to standard output (e.g. rodent is eating). These behaviours should then be refined in the child classes to perform different behaviours, depending on the specific type of rodent, but only if the behaviour is different (e.g., mouse eating seeds or guinea pig eating grass). Test the Rodent classes by developing a main() class and creating instances of every rodent, and demonstrate all the behaviours for each rodent.
Step by Step Solution
There are 3 Steps involved in it
Heres a Java implementation of the inheritance hierarchy for the Rodent classes java class Rodent pu... View full answer
Get step-by-step solutions from verified subject matter experts
