Homework 08

Cats and Dogs

11/24/2017 at 11:55PM

 

Objective:

 

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.

 

Notes

 

 

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

 

Additional Notes:

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!

 

Finally:

Upload the .java files to the dropbox