SDSU CS 596 OODP
Program 1

[To Course Home Page]
San Diego State University -- This page last updated Septemper 7, 1995
----------

CS 596 OODP
Programming Assignment 1
Due Thursday, Sept. 14

1) Implement and test a Point class. Objects created from this class represent a point in a two dimension coordinate system or plane. Each point represents an x and a y coordinate. There are 7 operations that are important for a Point object. You must be able to create a point from two numbers (floats or integers). Given two points, say A and B, you must be able to add, subtract, and compare them. That is compute A + B, A - B, A <= B, and A >= B. You may use the names "add", "subtract", "greaterThan", and "lessThan" rather than the symbols "+", "-", "<=", ">=". You need to compute the distance between A and B. Finally, you need a print operation that will print a representation of the point on a stream. That is if A has x coordinate of 5 and y coordinate of 11, you need to print on the stream "(5,11)".

2) Implement and test a Rectangle class. Instances of the rectangle class represent a point in a two dimension coordinate system. A rectangle can be specified by giving the points in the upper left corner and lower right corner of the rectangle (see diagram below).

You must implement the following operations on a rectangle:
Note: printing the point and rectangle on the screen will come later.

Two separate files, header and implementation, are required for each class. You need a program that tests the two classes. The classes need to be compiled. The binaries for the classes need to be linked to the test program. That is you are not allowed to compile the classes and the test program as one file. You need a make file or its equivalent that will compile the classes and the test program. Turn in the classes, test program, make file, and output from the program.