Design a class called Pet ( the class file should be called Pet.java ) , with the following fields:

  • Name
    The Name field holds the name of the pet
    Example values: Spot, Fluffy
  • Type
    The Type field holds the type of animal that the pet is
    Example of values: "Dog", "Cat", "Bird", "Fish", "Rabbit", "Guinea pig", "Turtle"
  • Age
    The Age field holds the age of the pet (in years)
    Example values: 1, 9
  • Height
    The Height field holds the height of the pet
    Example values: 2.5
  • Weight
    The Weight field holds the weight of the pet
    Example values: 16.5, 3.0
  • Color
    The Color field holds the color of the pet
    Example values: orange, brown

The Pet class should also have the following methods:

  • SetName
    The setName method stores a value in the Name field
  • GetName
    The getName method returns the value of the Name field
  • SetType
    The setType method stores a value in the Type field
  • GetType
    The getType method returns the value of the Type field
  • SetAge
    The setAge method stores a value in the Age field
  • GetAge
    The getAge method returns the value of the Age field
  • SetHeight
    The setHeight method stores a value in the Height field
  • GetHeight
    The getHeight method returns the value of the Height field
  • SetWeight
    The setWeight method stores a value in the Weight field
  • GetWeight
    The getWeight method returns the value of the Weight field
  • SetColor
    The setColor method stores a value in the Color field
  • GetColor
    The getColor method returns the value of the Color field
  • PrintStory
    The PrintStory method should display/output to the console the following message (inserting values for the class field into the appropriate location):
    There once was a COLOR TYPE named NAME who lived in Dallas, Texas. In 2018, when it was AGE years old, NAME was HEIGHT feet tall and WEIGHT pounds. NAME was a happy TYPE and had long and happy life.

Once you have designed the class, design a program/project/driver class (the program/project/driver class file should be called [YourName]Assignment1; replace [YourName] with your actual name) that creates an object of the class Pet and prompt the user to enter (in a descriptive/user-friendly way 2 ) the name, type, age, height, weight, and color, of his or her pet. This data should be stored in the object using the corresponding Set methods. Use the objects accessor Get methods to retrieve the data from the object (the pets name, type, age, weight, and color) and confirm it / PrintStory . You will need to add the class Pet to the [YourName]Assignment1 project and add your code to the project/driver class main method.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.