Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Define a class called Animal that abstracts animals and supports three methods: setSpecies(species): Sets the species of the animal object to species. setLanguage(language): Sets the

1.Define a class called Animal that abstracts animals and supports three methods:

setSpecies(species): Sets the species of the animal object to species.

setLanguage(language): Sets the language of the animal object to language.

speak(): Prints a message from the animal as shown below.

The class must support supports a two, one, or no input argument constructor.

Then define Bird as a subclass of Animal and change the behavior of method speak() in class Bird.

>>> snoopy = Animal('dog', 'bark')

>>> snoopy.speak()

I am a dog and I bark.

>>> tweety = Animal('canary')

>>> tweety.speak()

I am a canary and I make sounds.

>>> animal = Animal()

>>> animal.speak()

I am a animal and I make sounds.

>>> daffy = Bird()

>>> daffy.speak()

quack! quack! quack!

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions