Question: Java inheritance Here is a description of the classes you will implement: fit them appropriately into the inheritance hierarchy. Use the UML diagram provided Animal
Java inheritance

Here is a description of the classes you will implement: fit them appropriately into the inheritance hierarchy. Use the UML diagram provided Animal (not the same Animal class as in our lecture class simulations): Animal is an abstract class with 3 fields: the Animal's name. the Zoo the animal is located in (of type Zoo), and a field of type int called hungerLevel(O is full and 10 is starving). The constructor should take as parameters a Zoo object called myzoo (more on that in Activity 2) representing the zoo that animal is located in, and a String that is the name of the animal. The constructor should set the hungerLevel to 0. Maintaining hunger level Make sure to include get/set methods for hungerLevel and name. The setter method for hungerLevel should guarantee that it is set in the range 0 to 10 (ie, trying to set hungerLevel to 11 would result in it being set to 10, and trying to set it to -4 would result in it being set to 0) Additional methods in the Animal class include a sleep) method that simply printin's "sleeping... and maximizes the hungerLevel The class also has a roamO method that simply printin's "moving around... and increases hungerLevel by one. The class has an abstract makeNoise) method and an abstract eat() method. Only the get methods described above should return anything. Only Other classes . Canine is an abstract class that is a subclass of Animal. Canine overrides the roam) method to println "like canines roam in packs... (and still increases hungerLevel by one). Like the Animal class, its constructor contains the parameters Zoo myzoo and name. This is true for every Animal sub-class. .Feline is another abstract sub-class of Animal: This abstract class overrides the roam() method with "felines like to roam alone..." e Dog is a concrete canine class. The method makeNoise) should "bark...". The method eato should "slop..." and decreases hunger level by three using mutator and accessor .Wolf is a concrete canine class. The method makeNoise0 should "growl...". The method eat should "rip withteeth." and decreases hunger by two. . Cat is a concrete feline class. The method makeNoise() should "meoW...". The method eat0 should "pick... and decrease the hunger level by three . Hippo is a concrete animal class. The method makeNoise0 should "blub...". The method eat0 should "slurp... and decreases hunger by one. . Add a Coyote class (think "howl" and "gnaws" and decrease hunger like a wolf). . Add a Lion class (think "roar and "rip with teeth... and decrease hunger like a wolf .Add a FeralCat and WildDog class similar to the Cat and Dog classes above. Write a Zoo class that has four fields: the name of the zoo, two doubles for latitude and longitude, and an ArrayListAnimal> called zooAnimals. The constructor takes a String as the name of the zoo and two doubles: the latitude and longitude. It also should create the ArrayList. The class should have get methods for the latitude and longitude. Also have an addAnimal method which takes an Animal as a parameter, and adds it to your ArrayList. Also, have a testAnimals0 method which prints the name of the zoo, the location of the zoo in latitude and longitude, the number of animals in the zoo, and uses a for-each loop to print the behavior for each animal. For each animal: (1) first have it go to sleep(). (2) They will then be hungry (sleep changes hungerLevel, remember!) so have them makeNoise0 and then eat). (3) After eating they are full and will roam). Write a main method inside the Zoo class. The main method should create a Zoo object, create one animal object of each kind of animal and add it to the zoo. Choose an appropriate name of each animal that clearly indicates the type of animal, such as Leo the Lion. Do not accept keyboard input within you main method. There. you've tested all the methods on all the objects! Each of the method calls in the testAnimal method are polymorphic since you get an Animal out of the zooAnimal ArrayList and call the method but not really knowing (or caring) the specific type of animal . Add a Pet interface that defines a play and beFriendlyo method for the Cat and Dog classes. The feral cat and wild dog will not implement this interface Have the appropriate animal(s) above implement the interface (make sure the cats "frolic..." when they play and "purr..." when they are friendly) and then test this out in your Zoo classes testAnimalso method. Because not all animals will implement the Pet interface, youl have to use the instanceof keyword to determine if the current Animal contains the playo and beFriendlyo methods Add an AnimalLocation interface for a place that contains a bunch of animals (such as a Zoo). The AnimalLocation interface should define the following methods: String getNameo. setName(String). int getNumOfAnimals). Now modify your Zoo class to implement this interface Here is a description of the classes you will implement: fit them appropriately into the inheritance hierarchy. Use the UML diagram provided Animal (not the same Animal class as in our lecture class simulations): Animal is an abstract class with 3 fields: the Animal's name. the Zoo the animal is located in (of type Zoo), and a field of type int called hungerLevel(O is full and 10 is starving). The constructor should take as parameters a Zoo object called myzoo (more on that in Activity 2) representing the zoo that animal is located in, and a String that is the name of the animal. The constructor should set the hungerLevel to 0. Maintaining hunger level Make sure to include get/set methods for hungerLevel and name. The setter method for hungerLevel should guarantee that it is set in the range 0 to 10 (ie, trying to set hungerLevel to 11 would result in it being set to 10, and trying to set it to -4 would result in it being set to 0) Additional methods in the Animal class include a sleep) method that simply printin's "sleeping... and maximizes the hungerLevel The class also has a roamO method that simply printin's "moving around... and increases hungerLevel by one. The class has an abstract makeNoise) method and an abstract eat() method. Only the get methods described above should return anything. Only Other classes . Canine is an abstract class that is a subclass of Animal. Canine overrides the roam) method to println "like canines roam in packs... (and still increases hungerLevel by one). Like the Animal class, its constructor contains the parameters Zoo myzoo and name. This is true for every Animal sub-class. .Feline is another abstract sub-class of Animal: This abstract class overrides the roam() method with "felines like to roam alone..." e Dog is a concrete canine class. The method makeNoise) should "bark...". The method eato should "slop..." and decreases hunger level by three using mutator and accessor .Wolf is a concrete canine class. The method makeNoise0 should "growl...". The method eat should "rip withteeth." and decreases hunger by two. . Cat is a concrete feline class. The method makeNoise() should "meoW...". The method eat0 should "pick... and decrease the hunger level by three . Hippo is a concrete animal class. The method makeNoise0 should "blub...". The method eat0 should "slurp... and decreases hunger by one. . Add a Coyote class (think "howl" and "gnaws" and decrease hunger like a wolf). . Add a Lion class (think "roar and "rip with teeth... and decrease hunger like a wolf .Add a FeralCat and WildDog class similar to the Cat and Dog classes above. Write a Zoo class that has four fields: the name of the zoo, two doubles for latitude and longitude, and an ArrayListAnimal> called zooAnimals. The constructor takes a String as the name of the zoo and two doubles: the latitude and longitude. It also should create the ArrayList. The class should have get methods for the latitude and longitude. Also have an addAnimal method which takes an Animal as a parameter, and adds it to your ArrayList. Also, have a testAnimals0 method which prints the name of the zoo, the location of the zoo in latitude and longitude, the number of animals in the zoo, and uses a for-each loop to print the behavior for each animal. For each animal: (1) first have it go to sleep(). (2) They will then be hungry (sleep changes hungerLevel, remember!) so have them makeNoise0 and then eat). (3) After eating they are full and will roam). Write a main method inside the Zoo class. The main method should create a Zoo object, create one animal object of each kind of animal and add it to the zoo. Choose an appropriate name of each animal that clearly indicates the type of animal, such as Leo the Lion. Do not accept keyboard input within you main method. There. you've tested all the methods on all the objects! Each of the method calls in the testAnimal method are polymorphic since you get an Animal out of the zooAnimal ArrayList and call the method but not really knowing (or caring) the specific type of animal . Add a Pet interface that defines a play and beFriendlyo method for the Cat and Dog classes. The feral cat and wild dog will not implement this interface Have the appropriate animal(s) above implement the interface (make sure the cats "frolic..." when they play and "purr..." when they are friendly) and then test this out in your Zoo classes testAnimalso method. Because not all animals will implement the Pet interface, youl have to use the instanceof keyword to determine if the current Animal contains the playo and beFriendlyo methods Add an AnimalLocation interface for a place that contains a bunch of animals (such as a Zoo). The AnimalLocation interface should define the following methods: String getNameo. setName(String). int getNumOfAnimals). Now modify your Zoo class to implement this interface