Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP WITH THIS PYTHON PROGRAM PLEASE! Write a class named Pet, which should have the following data attributes: name (for the name of a pet)

HELP WITH THIS PYTHON PROGRAM PLEASE!
image text in transcribed
Write a class named Pet, which should have the following data attributes: name (for the name of a pet) . type (for the type of animal that a pet is. Example values are Dog Cat, and 'Bird) The Pet class should have an init method that initialize these data attributes. The Pet class should also have setter and getter methods for both of the data attributes. Additionally, the Pet class should have a make sound method which prints Then, write a main program that creates a Pet instance (specifically, a bird named "Captain"), and call the appropriate method to have him making the sound. For your reference, I attached the Automobile class which has appeared in exercises before: class Automobile: def init (self, make, model, mileage): self._ _make make self. model model self.__mileage mileage . (self, make, model, mileage: def set make(self, make): self _make make def set model(self, model): self. model model def set mileage(self, mileage): self. mileage mileage def get make(self): return self. make def get model(self): return self. model def get mileage(self): return self. mileage

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions