Course Home | Assignments | Class Photo | Computing Resources | Lab Hours/Tutoring | Schedule | Submit

Saint Louis University

Computer Science 150
Introduction to Object-Oriented Programming

Michael Goldwasser

Spring 2010

Dept. of Math & Computer Science

Homework Assignment 08

Class Definitions

Contents:


Overview

Topic: Good Software Practices
Related Reading: Chapter 7
Due: 9:00am, Friday 26 March 2010 ELECTRONICALLY

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

Note: Although the "homework" sets are typically submitted on paper in class, we have chosen to have this assignment submitted electronically (for reasons that will soon be obvious). We have created a folder hw08 on the online submit system for this purpose (not to be confused with unrelated prog08).
  1. (10 points)

    Exercise 7.5 of the text

    Please do this problem electronically. You should be able to see the effect of your documentation by doing help(Point) in the interpreter after loading the definitions.

    The original undocumented code can be found here (or as turing:/Public/goldwasser/150/book/ch06/RobustPoint.py)

  2. (10 points)

    Exercise 7.8 of the text

    Please see Practice 7.6 and its solution for a start (albeit brief).

    Although unintentional, this is a particularly relevant exercise given that the version of Fraction published in the book is flawed! The provision of __eq__ and __lt__ does not suffice for supporting all of the expected comparison operators: <, <=, > >=, ==, !=. Make sure that your unit tests examine each of those operations, and that they tangibly demonstrate the flaws that exist with the published code. My recommend style for this is to have tests that produce no output when the code is successful, but error messages when a flaw is discovered.

    The original untested code, together with embedded gcd function, can be found here (or piecewise within turing:/Public/goldwasser/150/book/ch06/).


Extra Credit

  1. (2 points)

    Exercise 7.9 of the text


Michael Goldwasser
CSCI 150, Spring 2010
Last modified: Friday, 19 March 2010
Course Home | Assignments | Class Photo | Computing Resources | Lab Hours/Tutoring | Schedule | Submit