Question: Using Java, implement the following: Animals The Animal class represents the animals in an animal shelter, which contains only Cat and Dog currently. Each animal
Using Java, implement the following:

Animals The Animal class represents the animals in an animal shelter, which contains only Cat and Dog currently. Each animal in the shelter has its own name and order, which can be obtained with methods String getName() and int getorder(). Each animal can emit a cry with method String cry, where for a dogs this produces "bark" while for cats is "meow". 1. Implement the abstract class Animal. 2. Implement the two subclasses of Animal to represent a cat or a dog. 3. Implement a class Animal Shelter, which operates with a "first in first out" basis. When an animal comes into the shelter with the method addAnimal(), it will be assigned an order number that represents its order in the waiting queue. People who want to adopt the animal must adopt either the "oldest" one (based on arrival time) or they can select whether they prefer a dog or a cat and will receive the oldest animal of that type). After an animal is adopted, the order number of the remaining animals should change correspondingly. You should implement AnimalShelter with three different methods for adopting: adopt(), adoptCat(), adoptDog(). In order to check the remaining animals, cats and dogs in the shelter, you should also implement methods: remainingAnimals(), remainingCats(), remainingDogs(), which show the name, order and cry of remaining animals, cats and dogs. 4. Implement a class Main, of which users can make a selection through the options provided by the main() method. The main method should provide an interactive prompt as below: 1: Add new animal 2: Adopt an animal 3: Adopt a cat 4: Adopt a dog 5: Show anaimals in the shelter 6: Show cats in the shelter 7: Show dogs in the shelter 0: Exit Enter a number: The main() method can accept command line arguments as input, it will process the input string, construct corresponding animals and store them in a shelter. The input is given according to the following specification: == "Canimal>" Canimals>E = = c := d This specification is given as a grammar in a structured notation called Backus-Naur form (BNF). The use of BNF is very commmon in describing program language syntax and we will see more of it. If you've not encountered BNF before, the wikipedia article provides an explanation and some simple examples to help you understand how to make sense of the specification above. Note that is a string, you can assume that animals come in the same order as input. Here is an example with a sequence of cats and dogs: > java Main "d Adam" "d Bob" "d Carmy" "c Daisy" Animals The Animal class represents the animals in an animal shelter, which contains only Cat and Dog currently. Each animal in the shelter has its own name and order, which can be obtained with methods String getName() and int getorder(). Each animal can emit a cry with method String cry, where for a dogs this produces "bark" while for cats is "meow". 1. Implement the abstract class Animal. 2. Implement the two subclasses of Animal to represent a cat or a dog. 3. Implement a class Animal Shelter, which operates with a "first in first out" basis. When an animal comes into the shelter with the method addAnimal(), it will be assigned an order number that represents its order in the waiting queue. People who want to adopt the animal must adopt either the "oldest" one (based on arrival time) or they can select whether they prefer a dog or a cat and will receive the oldest animal of that type). After an animal is adopted, the order number of the remaining animals should change correspondingly. You should implement AnimalShelter with three different methods for adopting: adopt(), adoptCat(), adoptDog(). In order to check the remaining animals, cats and dogs in the shelter, you should also implement methods: remainingAnimals(), remainingCats(), remainingDogs(), which show the name, order and cry of remaining animals, cats and dogs. 4. Implement a class Main, of which users can make a selection through the options provided by the main() method. The main method should provide an interactive prompt as below: 1: Add new animal 2: Adopt an animal 3: Adopt a cat 4: Adopt a dog 5: Show anaimals in the shelter 6: Show cats in the shelter 7: Show dogs in the shelter 0: Exit Enter a number: The main() method can accept command line arguments as input, it will process the input string, construct corresponding animals and store them in a shelter. The input is given according to the following specification: == "Canimal>" Canimals>E = = c := d This specification is given as a grammar in a structured notation called Backus-Naur form (BNF). The use of BNF is very commmon in describing program language syntax and we will see more of it. If you've not encountered BNF before, the wikipedia article provides an explanation and some simple examples to help you understand how to make sense of the specification above. Note that is a string, you can assume that animals come in the same order as input. Here is an example with a sequence of cats and dogs: > java Main "d Adam" "d Bob" "d Carmy" "c Daisy