Starting from:

$25

METCSS521-Assignment 6 Solved

In this assignment, you will be demonstrating your understanding and use of python classes and inheritance and polymorphism, as covered in module 6.

 

Assignment Background 
 

This assignment makes use of inheritance to create a set of related classes.  At the end, you will have a more complex structure of parent-child classes than you saw in the module’s examples. 

 

Assignment Statement 
 

•        You will create the following classes using inheritance:

o A base class called Pet o A mix-in class called Jumper o A Dog class and a Cat class that each inherit from Pet and Jumper o Two classes that inherit from Dog: BigDog and SmallDog o One classes that inherit from Cat: HouseCat

•        The general skeleton of the Pet, Dog, and BigDog classes will be given to you, but you will have to identify the required inheritance for a class.  You will be responsible for writing the functionality of those classes and their methods.

•        A description of each class’s functionality, as well as the data to use, is in the requirements below.  

•        You will be required to write the code to exercise your classes per the requirements.

 

             

Requirements 
Use the provided template to complete the following.  The details are in the skeleton file.

1.     The  Pet class:

a.      Assign values to two variables: kind and color

b.     Implement the constructor to initialize the pet’s name

c.      Implement __str__ method per skeleton

d.     Implement do_tricks method per skeleton

2.     The Jumper class

a.      Implement the jump method per the skeleton

3.     The Dog class

a.      Decide which classes to inherit from and implement inheritance

b.     Change the kind to canine

c.      Implement __str__ per skeleton

d.     Implement __call__ per skeleton

4.     The BigDog class

a.      Change the color to tan

b.     Implement __str__ per skeleton

c.      Implement speak per skeleton

5.     The SmallDog class

a.      Change the color to brindle

b.     Implement __str__ per skeleton

c.      Implement speak per skeleton

6.     The Cat class

a.      Change the kind to feline

b.     Implement __str__ per skeleton

c.      Implement speak per skeleton

d.     Implement climb per skeleton

7.     The HouseCat class

a.      Change the color to white

b.     Implement __str__ per skeleton

c.      Implement speak per skeleton

8.     Create the code to exercise the class structure according to the following:

a.      Instantiate each class(except Jumper)

b.     Create a list of the instantiated objects

c.      Loop through the objects

d.     For each object:

i.      Print __str__

ii.    print the kind of pet

iii.  Print the Color of the pet

iv.   Have the pet do tricks

v.     if applicable, print rollover action and the owners name

vi.   If applicable, have the pet climb vii. To separate each pet, print a line of underscores or dashes

Sample Output 
Your output should look something like this and should be in this order:

 

I am a brown animal named Rover animal brown

Rover is doing tricks

---------------------------------------- I am a cat named Lion

feline

brown

Lion is doing tricks Lion says Meow!!!

Lion is jumping

Lion is climbing the curtains again – note climbing action is for Cats

----------------------------------------

I am a dog named Roo

canine brown

Roo is doing tricks

Roo is jumping

Roo is rolling over – note rollover and owner actions are for Dogs

My owner is George

---------------------------------------- Noah is a large, muscular dog canine tan

Noah is doing tricks Noah says Woof!!! Noah is jumping

Noah is rolling over

My owner is George

---------------------------------------- Lucky is a tiny, cute dog canine brindle

Lucky is doing tricks Lucky says Yip!

Lucky is jumping

Lucky is rolling over

My owner is George

---------------------------------------- Zebra is a cat with fluffy, white fur feline white

Zebra is doing tricks

Zebra says Purr

Zebra is jumping

Zebra is climbing the curtains again

----------------------------------------

 

Process finished with exit code 0  

More products