Question: Design a program which solves the problem described in the problem statement below. Provide comments in your pseudo-code and Java program as necessary. It must

Design a program which solves the problem described in the problem statement below. Provide comments in your pseudo-code and Java program as necessary. 

It must include these components:  

  1. UML Class diagram 
  2. Flowchart  
  3. Pseudo-code 
  4. Program Coded 
  5. 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 pet’s 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 object’s accessor methods to retrieve the pet’s 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

3.48 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the problem of designing a program based on the provided requirements we will break it down into several steps We will start by creating a UM... View full answer

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