subject

Write a python class named Pet, which should have the following data attributes: __name(for the name of a pet)
__animal_type(for the type of animal that a pet is. Example values are 'Dog','Cat', and 'Bird')
__age(for the pets age)

The Pet class should have an __init__ method that creates these attributes. It should also have the following methods:

set_name This method assigns a value to the __name field
set_animal_type This method assigns a value to the __animal_type field
set_age This method assignsa value to the __age field
get_name This method assignsa value to the __name field
get_animal_type This method assignsa value to the __animal_type field
get_age This method assignsa value to the __age field

Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type and age of his or her pet. This data should be stored as the objects attributes. Use the objects accessor methods to retrieve the pets 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, 22.06.2019 17:30, glocurlsprinces
Rachel completed typing an official document with a word processing program. she wants to make sure that her document has no typographical errors. she also wants all headings to have the same font. which features in a word processing program should she use? rachel should use the feature in a word processing program to find typographical errors. she should apply to have uniform headings.
Answers: 1
image
Computers and Technology, 23.06.2019 00:00, eguzmandpandoracom
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
image
Computers and Technology, 23.06.2019 13:10, BrianKeokot4534
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
image
Computers and Technology, 24.06.2019 19:00, cxttiemsp021
Luis is cloud-based( microsoft bot framework). true false
Answers: 1
You know the right answer?
Write a python class named Pet, which should have the following data attributes: __name(for the nam...

Questions in other subjects: