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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
What role do chromosomes play in inheritance?
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
Retype the statements, correcting the syntax errors. system.out.println("num: " + songnum); system.out.println(int songnum); system.out.println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
What percentage of teens plays video games? a.97% b.100% c.74% d.50%
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
question
Social Studies, 28.08.2019 05:30
question
Mathematics, 28.08.2019 05:30
Questions on the website: 13722360