Question: Write a java programPart 1 . Implement the classes Animal and Zoo as presented in the following UML diagramZoo - animals: Animall ] + Zoo

Write a java programPart 1. Implement the classes Animal and Zoo as presented in the following UML diagramZoo- animals: Animall]+Zoo(setOfAnimals: String)+getAnimals: Animal(]+countCatsO: int +count Young: int +toString(: StringAnimaltype: Stringcolor : Stringage: int+Animal (type: String, color: String, age: int)+ getters+ is YoungO: booleanThe class Animal contains:Fields:The animal's type: must be cat or bird.The animal's color.o The animal's age in months.Methods:All-arguments constructor. All gettersThe boolean method isYoung) of the class Animal: checks if an animal is young or not. An animal is young if it is a cat with age greater than 10 months, or if it is a bird with age greater than 3 months.The class Zoo contains:Fields:An array of animals.Methods:A constructor that creates a Zoo abject. The constructor takes as parameter a String formed of a set of animals' descriptions separated by a dash (-), as in the following example:black cat 2- red bird 6- white cat 12-...The constructor extracts the information about each animal (type, color, age) and fill the array animals.We assume that each animal's description follows the format: color (space) type|space)age (example black cat 2)The getter of the array animalsA method countCats that returns the number of cats in the zoo.A method count Young that returns the number of young animals in the zoo.A method toString that prints the information about the Zoo as in the following example:The Zoo contains 4 cats and 2 birds.Part 2. Implement a driver class to test the classes in Part 1 as follows:Read from the user a String formed of animals' descriptions and create a Zoo objectDisplay the count of young animals in the Zoo.Display the information about the Zoo.Without adding extra methods to the classes Zoo and Animal, write in the driver the code to search for and display the number of red animals in the Zoo.Without listing
Write a java programPart 1 . Implement the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!