Computers and Technology

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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 21:00, webbjalia04
Uget brainliest if accurate mary has been given the responsibility of hiring a person for the position of a software testing officer. which management function would mary achieve this responsibility?
Answers: 1
image
Computers and Technology, 24.06.2019 00:50, sequoyaburke
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
image
Computers and Technology, 24.06.2019 01:10, jaileen84
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates. json” file), in order of closest-to-farthest from the origin.
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, ratpizza
Which describes careers that have similar education requirements but different qualifications? product safety engineers and materials engineers industrial safety engineers and industrial health engineers quality control systems managers and inspectors industrial safety and health engineers and hand packers
Answers: 3
Do you know the correct answer?
Write a class named Pet, with should have the following data attributes:1._name (for the name of a p...

Questions in other subjects:

Konu
Mathematics, 12.08.2020 05:01
Konu
Mathematics, 12.08.2020 05:01