1.3-Object-Georienteerd-Programmeren

Zoo

This is a SaxionApp assignment. Please download the library at the relevant links section.

Today we will create a zoo with a certain number of cages. Next we will add animals to these cages (as you might expect to see in a zoo.) Only one type of animal may be stored in any given cage. So, as soon as an animal is added to the cage, only animals of the same type can be added. Each cage has a maximum capacity of 3.

There are four types of animals in our zoo. For each animal, we need to store its gender and its name. In addition, we need to store some specific attributes of different animals:

We want proper toString() methods in each class, so that we can easily print the properties of the different animals and the contents of the cages. In addition, provide good error handling.

Hints:

Part 2: Draw it!

We will now extend the Cage class with a void draw(int x, int y) method, with which we draw the cage at a certain location. We will also create a void draw(int x, int y). For each type of animal, an image is provided that you can use when drawing (download the images here).

Example

Example