Build a class PetShop with the following data members Name: String Address: String Inventory: ArrayList 1. Provide constructor and do appropriate initialization 2. Provide a method addPet(Pet p) that adds the pet object p to the inventory 3. Provide a method Pet getPetByID(String id) that searches in the inventory for the given pet and returns its instance 4. Provide a method boolean isThePetDead(String id) that searches for the pet with given id in the inventory and returns a true if the pet is dead or false othewise. 5. Provide the toString method that gives all details about the shop and the inventory.
Comments
Leave a comment