Question: Your solution must include these components: UML Class diagram Flowchart Pseudo - code Program Coded Program Output Problem Statement Design a class named Pet, which

Your solution must include these components:
UML Class diagram
Flowchart
Pseudo-code
Program Coded
Program Output
Problem Statement
Design a class named Pet, which should have the following fields:
name: The name field holds the name of a pet.
type: The type field hold the type of animal that a pet is (for example, dog,cat,bird)
age: The age field holds the pets age.
The Pet class should also have the following methods:
setName: the setName method stores a value in the name field.
setType: the setType method stores a value in the type field
setAge: the setAge method stores a value in the age field.
getName: the getName method returns the value of the name field.
getType: The getType method returns the value of the type field.
getAge: the getAge method returns the value of the age field.
Once you have designed the class, design a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored in the object. Use the objects accessor methods to retrieve the pets name, type, and age and display this data on the screen.
Expected Output
Your results should be similar to the following:
Please enter the name of your pet: Maestro
Please enter the type of your pet: dog
Please enter the age of your pet: 8
The name of your pet is Maestro.
Maestro is a dog.
Maestro is 8 years old.

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