Question: Design a class called Pet (the class file should be called Pet.java), with the following fields Field Description Name The Name field holds the name

 Design a class called Pet (the class file should be called

Design a class called Pet (the class file should be called Pet.java), with the following fields Field Description Name The Name field holds the name of the pet Type The Type field holds the type of animal that the pet is "Dog","Ct"Bird","Fish", Example of values Age The Age field holds the age of the pet (in years) Weight The Weight field holds the weight of the pet Rabbit", "Guinea pig", "Turtle" 1, 9 16.5, 3.0 The Pet class should also have the following methods: Method Description setName The setName method stores a value in the Name field getName The getName method returns the value of the Name field seffype The setType method stores a value in the Type field getType The getType method returns the value of the Type field setAge getAge The getAge method returns the value of the Age field setWeight The setWe getWeight The getWeight method returns the value of the Weight field The setAge method stores a value in the field t method stores a value in the Weight field Once you have designed the class, design a program/project/driver class (the program/project/driver class file should be called [YourNa object of the class Pet and prompt the user to enter (in a descriptive/user-friendly way) the name, type, age, and weight of his or her pet. This data should be stored in the object. Use the object's accessor methods to retrieve the data from the object (the pet's name, type, age, and weight) and confirm it (display in on the screen, in a user-friendly way). You will need to add the class Pet to the [YourName]-Assignment3 project and add your code to the project/driver class main method signment3; replace [YourName] with your actual name) that creates an

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!