Create a Class Pet with the following data members  Identification: String  species : String (e.g. cat, dog, fish etc)  breed: String  Age (in days): int   Weight: float   Dead: boolean  1. Provide a constructor with parameters for all instance variables.  2. Provide getters for all and setters for only breed, and weight  3. Provide a method growOld() that increases the age of the pet by one day. A dead pet wont grow old 4. Provide a method growHealthy(float w) that increases the weight of the pet by the given amount w. A dead pet cannot grow healthy. 5. Provide a method fallSick(float w) that reduces the weight of the pet by the given amount. The least weight a pet can have is 0 which will mean that the pet has died. If the value of weigh is 10 kg and the method is called with an argument of 11 kg then you will set it to 0 and set the dead to an appropriate value to mark the death of the pet 6. Provide a toString method that shows an appropriate well formatted string represntation of a pet object    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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Create a Class Pet with the following data members

  •  Identification: String
  •  species : String (e.g. cat, dog, fish etc)
  •  breed: String
  •  Age (in days): int
  •   Weight: float
  •   Dead: boolean

 1. Provide a constructor with parameters for all instance variables.

 2. Provide getters for all and setters for only breed, and weight

 3. Provide a method growOld() that increases the age of the pet by one day. A dead pet wont grow old

4. Provide a method growHealthy(float w) that increases the weight of the pet by the given amount w. A dead pet cannot grow healthy.

5. Provide a method fallSick(float w) that reduces the weight of the pet by the given amount. The least weight a pet can have is 0 which will mean that the pet has died. If the value of weigh is 10 kg and the method is called with an argument of 11 kg then you will set it to 0 and set the dead to an appropriate value to mark the death of the pet

6. Provide a toString method that shows an appropriate well formatted string represntation of a pet object

 

 Build a class PetShop with the following data members

  •  Name: String
  •   Address: String
  •   Inventory: ArrayList<Pet>

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. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY