Create an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig. In the base class, provide methods that are common to all rodents based on behaviours you find with a quick Internet search. Be sure to document the behaviours you implement (e.g., eat, sleep, groom, move, etc.). Each behaviour should print its action to standard output (e.g., rodent eating). Next, refine these behaviours in the child classes to perform different behaviours, depending on the specific type of rodent, but only if the behaviour is actually different (e.g., mouse eating seeds or guinea pig eating grass) Test your Rodent classes by writing a main() class and creating instances of every rodent, and demonstrate all the behaviours for each rodent. When solving can you write comments on the code explaining it.
Create an inheritance hierarchy of Rodent: mouse, gerbil, hamster, guinea pig.
In the base class, provide methods that are common to all rodents based on behaviours you find with a quick Internet search. Be sure to document the behaviours you implement (e.g., eat, sleep, groom, move, etc.). Each behaviour should print its action to standard output (e.g., rodent eating).
Next, refine these behaviours in the child classes to perform different behaviours, depending on the specific type of rodent, but only if the behaviour is actually different (e.g., mouse eating seeds or guinea pig eating grass)
Test your Rodent classes by writing a main() class and creating instances of every rodent, and demonstrate all the behaviours for each rodent.
When solving can you write comments on the code explaining it.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 6 images