subject

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 holds the type of animal that a pet is. Example values are"Dog", "Cat", and "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 theclass 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 cat’s name, type, and age and display this data on the screen.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 22.06.2019 16:30
Primary tech skills are skills that are necessary for success in online education
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
You know the right answer?
Design a class named Pet, which should have the following fields:name: The name field holds the nam...
Questions
question
Mathematics, 19.02.2020 06:44
question
Mathematics, 19.02.2020 06:44
question
Mathematics, 19.02.2020 06:44
question
Geography, 19.02.2020 06:45
question
Chemistry, 19.02.2020 06:47
Questions on the website: 13722363