Question: *** I need it in Java *** *** I need it in Java *** Write a program where a user populates a collection of various

*** I need it in Java ***
*** I need it in Java ***

Write a program where a user populates a collection of various cats and dogs. The user should be able to specify which type they wish to enter, and then are prompted with the pertinent information for every type of pet.

Requirements:

The structure of the program should follow this UML class diagram.

You may also include helper methods and attributes that are not noted in the class.

Additional Notes:

  • The weight for animal should be strictly greater than 0
  • The mood for a cat should either be sleepy, playful, or hungry
  • The energy level for a dog should be between 0 and 100 inclusively
  • The type of house cat should one of the following
    • Short Hair
    • Bombay
    • Ragdoll
    • Sphinx
    • Scottish Fold
  • The type of domestic dog should be one of the following
    • Retriever
    • Terrier
    • Husky
    • Yappy
    • Mutt
  • In addition to whats specified in the UML diagram, the classes, Animal, Cat, Dog, HouseCat, Leopard, Domestic Dog, and Wolf must have
    • Constructors (Both default and parameterized)
    • Accessors and Mutators
    • A toString method
    • An equals method
  • In addition to whats specified in the UML diagram, AnimalCollection only needs a default constructor which will set the array of animals to some constant default size. Also no Accessors or Mutators.
  • Remember the block arrows are the is a relationship so it means inheritance
  • The line arrows are the has a relationship so it contains one or more instances of that class

Example Output:

Welcome to the Cat and Dog Collection!

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

Enter a selection

1

Would you like to add a 1. House Cat, 2. A Leopard, 3. A Domestic Dog, or 4. A wolf

1

Enter the house cat's name, weight, mood, and type

Roscoe

20

Hungry

Bombay

Current Collection

Name: Roscoe Weight: 20.0 Mood: Hungry Type: Bombay

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

Enter a selection

1

Would you like to add a 1. House Cat, 2. A Leopard, 3. A Domestic Dog, or 4. A wolf

3

Enter the domestic dog's name, weight, energy level, and type

Maggie

50

75

Retriever

Current Collection

Name: Roscoe Weight: 20.0 Mood: Hungry Type: Bombay

Name: Maggie Weight: 50.0 Energy Level:75 Type: Retriever

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

Enter a selection

1

Would you like to add a 1. House Cat, 2. A Leopard, 3. A Domestic Dog, or 4. A wolf

2

Enter the leopard's name, weight, mood, and number of spots

Chester

200

Playful

100

Current Collection

Name: Roscoe Weight: 20.0 Mood: Hungry Type: Bombay

Name: Maggie Weight: 50.0 Energy Level:75 Type: Retriever

Name: Chester Weight: 200.0 Mood: Playful Number of Spots: 100

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

Enter a selection

1

Would you like to add a 1. House Cat, 2. A Leopard, 3. A Domestic Dog, or 4. A wolf

4

Enter the wolf's name, weight, energy level, and type

Ghost

200

90

Jon Snow

Current Collection

Name: Roscoe Weight: 20.0 Mood: Hungry Type: Bombay

Name: Maggie Weight: 50.0 Energy Level:75 Type: Retriever

Name: Chester Weight: 200.0 Mood: Playful Number of Spots: 100

Name: Ghost Weight: 200.0 Energy Level:90 Pack Leader Name: Jon Snow

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

Enter a selection

2

Enter the animal's name that is to be removed

Chester

Current Collection

Name: Roscoe Weight: 20.0 Mood: Hungry Type: Bombay

Name: Maggie Weight: 50.0 Energy Level:75 Type: Retriever

Name: Ghost Weight: 200.0 Energy Level:90 Pack Leader Name: Jon Snow

Would you like to

1. Add a cat or dog

2. Remove a cat or dog

3. Quit

3

Goodbye!

*** I need it in Java ***

*** I need it in Java ***

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 Databases Questions!