A zoo contains a large number of different types of animal


A zoo contains a large number of different types of animal. All animals respond to a message 'talk()' by announcing what they are and their name and age. Each type of animal is represented by a different sub-class of the animal class.

The zoo itself provides methods to add and subtract animals and responds to the message 'feedingTime()' by sending the message talk to all the animals.

Animal classes

Create an Animal class and appropriate sub-classes for say Lion, Tiger etc.

Zoo class

Create a Zoo class can contain a number of animals and provides methods to add and remove animals as well as responding to the method 'feedingTime()'.

Solution Preview :

Prepared by a verified Expert
Macroeconomics: A zoo contains a large number of different types of animal
Reference No:- TGS01598411

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)