Solve this Java problem ? We want to develop an inheritance hierarchy of Rodent: mouse, gerbil,
Question:
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.
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp