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 15:00
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
These statements describe lists in presentation programs: a. bullets can be turned off and on. b. bullets cannot be turned off. c. bullet styles, colors, and sizes can be changed. d. lists don't have to use bullets or numbers. e. numbering styles, colors, and sizes can be changed. f. numbers can be turned off and on. g. numbers cannot be turned off. select all that apply
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, 07.12.2020 22:20
question
French, 07.12.2020 22:20
question
History, 07.12.2020 22:20
Questions on the website: 13722362