faresbrayek2 / prosit-6

continuation for prosit 5.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zoo and Animal Classes (Continued)

Instruction 25

In the "Zoo" class, create an array called "aquaticAnimals" that can hold up to 10 aquatic animals.

Instruction 26

Create the method "public void addAquaticAnimal(Aquatic aquatic)" in the "Zoo" class. This method allows you to add aquatic animals to the "aquaticAnimals" array. Add aquatic animals in the "main" method in a zoo.

Instruction 27

Display the "swim()" method for all aquatic animals in your zoo. Take note of your observations.

Instruction 28

Modify the "swim()" method in the "Aquatic" class so that it must be overridden in all child classes.

Instruction 29

Create the method "public float maxPenguinSwimmingDepth()" in the "Zoo" class. This method returns the maximum swimming depth of your penguins in the zoo.

Instruction 30

Create the method "public void displayNumberOfAquaticsByType()" in the "Zoo" class. This method displays the number of dolphins and penguins in a zoo.

Instruction 31

Override the "equals()" method in the "Aquatic" class. Two aquatic animals are identical only if they have the same name, age, and habitat.

About

continuation for prosit 5.


Languages

Language:Java 100.0%