University of Toronto - Fall 2001
Department of Computer Science

Assignment 2

Due: Friday September 28, 9:00 a.m. - No late assignments will be accepted

Modeling Houses

You will build a simple program to model houses for a real estate office. The properties of each house are:

If the house is listed then there is no buyer.

If the house is unlisted, there is no buyer or price.

If the house is sold then all the information is relevant, and the price is the selling price.

What you need to do

You will complete the class House, which we have begun. We have provided a second class TestHouse that demonstrates how the methods in House are called. You must not make any changes to TestHouse. You must not change any of the House methods or variables that we provide. This will greatly constrain your design choices for House. This is intentional.

Steps

  1. Download files TestHouse.java and House.java and read them carefully. Class TestHouse contains a main method that makes use of class House.
  2. Create a CodeWarrior project TestHouse and include the two .java files. Remember to set the CodeWarrior Target Settings so that TestHouse is the main class.
  3. The program won't compile yet, because House.java is incomplete. Finish it. We have provided the method comments for five methods, and you need to write those methods. It's like a jigsaw puzzle: you can figure out what those five methods should be called and what their parameters are by looking at what happens in TestHouse.java and by carefully reading the method comments. You also need to figure out the last instance variable; there's a comment for that, too.
  4. Following the directions from the web site, submit your corrected House.java file electronically for marking. You do not need to submit TestHouse.java, because it hasn't changed. Yo do not need to submit any project files or .class files. Reread the rules for assignment submission to be certain you followed them.