This lab’s purpose is to provide students with experience in inheritance of classes and working with multiple classes. It is recommended that students use command line tools and editors for this lab (though it is not strictly speaking required). This lab will require students to build on their previous lab experience, in which a version of the cowsay utility was created.
cowsay.py (Program Driver) Your program must accept command line arguments as follows: python3 cowsay.py -l Lists the available cows python3 cowsay.py MESSAGE Prints out the MESSAGE using the default COW python3 cowsay.py -n COW MESSAGE Prints out the MESSAGE using the specified COW In addition, this version of the utility handles a special set of Cow-derived Dragon class (and its subclasses). Whenever a dragon-type cow is selected, the display of the message must be followed by a line stating whether or not the dragon is fire-breathing:
Cow Class __init__(self, name) // Constructor get_name(self) // Returns name of this cow object get_image(self) // Return image for this cow object set_image(self, image) // Sets the image for this cow object to image Dragon Class The Dragon class must be derived from the Cow class and must make all of its methods available. In addition, Dragon must provide the following methods: __init__(self, name, image) Constructor; creates a new Dragon object with the given name and image. can_breathe_fire() This method should exist in every Dragon class. For the default Dragon type, it should always return True. IceDragon Class The IceDragon class must be derived from the Dragon class and must make all of its methods available: __init__(self, name, image) Constructor; creates a new IceDragon object with the given name and image. can_breathe_fire() For the IceDragon type, this method should always return False. NOTE: Your output must match the example output *exactly*. Files: cowsay.py, cow.py, dragon.py, ice_dragon.py Method: Submit on Canvas
PROGRAMMING FUNDAMENTALS 1 Lab 8: The Cow Strikes Back