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, 22.06.2019 05:00
Pls do you believe that the use of 3d animation has grown in feature films over the last few years? if so, do you think the trend will continue? what are the forces driving this trend?
Answers: 2
question
Computers and Technology, 22.06.2019 10:30
How can a user open a blank presentation? 1.on the file menu, click new, and then click recent templates 2.on the file menu, click new, and then click blank presentation 3. on the view menu, click templates, and then click recent templates 4. on the view menu, click samples, and then click blank presentation
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
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, 11.11.2020 03:10
question
Arts, 11.11.2020 03:10
question
Physics, 11.11.2020 03:10
question
Mathematics, 11.11.2020 03:10