Your instructor may assign one or more of the following problems. Don’t feel that you must do all the problems; for the homeworks, you are only required to do those that are explicitly assigned via Moodle.

  1. Extend the Fraction class by adding these methods:

    Extend the console testing application that you started in the lab to include appropriate test cases for these new features.

  2. Create a python program named war.py that simulates a simplified version of the card game War. Use the following approach:

  3. Create a program called circle.py that implements a class that represents circle objects. Each circle has a center (modeled as an x-y coordinate tuple), a radius, color (modeled as a Python turtle color string, e.g., ‘black’) and a Boolean flag indicating whether it is to be drawn as filled or or just outlined. Circles cannot have negative radii.

    Implement the following features.

    Add code at the bottom of the module to exercise this class by creating a default circle, an invalid circle, circles that do and do not overlap, and generally testing the features provided by the class.

  4. Create a program called rectangle.py that implements a class that represents rectangle objects. Each rectangle has an upper left point (modeled as an x-y coordinate tuple), a width, a height and a color (modeled as a Python turtle color string, e.g., ‘black’). Rectangles cannot have negative widths or heights.

    Implement the following features.

    Add code at the bottom of the module to exercise this class by creating a default rectangle, an invalid rectangle, rectangles that do and do not overlap, and generally testing the features provided by the class.

Checking In

Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria: