Question: 2 ) Make a class definition for a pet. It should have the following attributes name weight species Create an _ _ init _ _

2) Make a class definition for a pet. It should have the following attributes name weight species
Create an __init__() function that has the self, and three arguments passed to it to initialize these attributes
Create the __str__() function that has self as an argument that will print a class instance with the attributes Duck, 60.5, Dog as Pet named Duck is 60.5 lbs and is a Dog
Create two additional instances of the pet class and use print to output them.
Make a UML Class Diagram for the Pet Class, and show the two additional instances UML diagrams for the two instances created

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!