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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, alowery89
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, Princessirisperez0
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e. g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
image
Computers and Technology, 23.06.2019 16:10, alexis9658
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
image
Computers and Technology, 23.06.2019 21:00, shawnnoteman1234
Which task uses a simple parameter?
Answers: 1
You know the right answer?
Design a class named Pet, which should have the following fields:name: The name field holds the nam...

Questions in other subjects:

Konu
Mathematics, 15.12.2020 20:50