subject

Write a class named Pet, with should have the following data attributes:1._name (for the name of a pet.2._animalType (for the type of animal that a pet is. Example, values are "Dog","Cat" and "Bird")3._age (for the pet's age)The Pet class should have an __init__method that creates these attributes. It should also have the following methods:-setName -This method assigns a value to the_name field-setAnimalType - This method assigns a value to the __animalType field-setAge -This method assigns a value to the __age field-getName -This method returns the value of the __name field-getAnimalType -This method returns the value of the __animalType field-getAge - This method returns the value of the __age fieldWrite 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 should be stored as the object's attributes. Use the object's accessor methods to retrieve the pet's name, type and age and display this data on the screen. Also add an __str__ method to the class that will print the attributes in a readable format. In the main part of the program, create two more pet objects, assign values to the attirbutes and print all three objects using the print statement. Note: This program must be written using Python language

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
What is the most important aspect of marking media? a. data labelingb. content descriptionc. electronic labelingd. classification
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year school. what is the expected total cost for one year at the local community college if kirk lives at home? what is the expected total cost for one year at the out-of-state school if kirk lives on campus?
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
You know the right answer?
Write a class named Pet, with should have the following data attributes:1._name (for the name of a p...
Questions
question
Mathematics, 27.06.2019 05:30
question
Mathematics, 27.06.2019 05:30
question
Biology, 27.06.2019 05:30
question
Advanced Placement (AP), 27.06.2019 05:30
Questions on the website: 13722363