Homework 4
(revised)

CS409 - Spring 2000

Due: Thursday, Feb 24

Revisions:

This is your first assignment that involves programming.  It is meant to be a moderately easy in order to give everyone a chance to try out Java. Even though this assignment is not difficult you should start early to ensure that you have enough time to complete it.  Programming, especially when using an unfamiliar language, can be time-consuming. 

You need to create a class that implements the ADT Rectangle. Rectangle is actually a hyper-rectangle since it is supposed to work for any dimension.  Here are the operations, in Java form, that Rectangle needs to handle:

Java has an extensive set of Exceptions that can be used to handle various kinds of errors.  The errors mentioned above fall into the category of IllegalArgumentException.  If such an error occurs then the following java code can be used:

throw new IllegalArgumentException("Useful info about problem");

What to turn in: We want to see two things:

  1. The file containing your implementation of class Rectangle.
  2. The output from a test program that uses your class.  This test program is not yet online, but when it is there will be a link to it on the HW04 Web page.

Some Useful Java Information