I was not sure which board to post this on because it is about an assignment that is partially an application and partially an
applet.
I am taking a class and it this is my homework assignment. I could use some help:
We have to develop a Rectangle Class with the following requirements:
- the class contains 3 private instance variables: width, length, color
- the class contains a variable called ID used for assigning a unique serial number to each object of that type: ID can be read but not changed.
- Rectangle can be constructed four different ways:
1. by specifying width, length, color
2. by specifying width, length
3. by specifying width (to create a square)
4. by specifying nothing(to create an object with default size)
Rectangel class contains methods for:
-computing the area
-drawing the rectangle using its color field
Rectangle class also contains the following methods:
setLength - for setting the length of the rectangle
setWidth - for setting the width of the rectangle
getLength - for returning the length of the rectangle
getWidth - for returning the with of the rectangle
equals - for checking to see whether two rectangles are identical( return true or false)
We have to write the class such that the height and width can only have values between 10 and 100. In other words, if the values are less than 10, they should equal 10, and if they are more than 100, they should equal 100.
There are 2
test classes we need to use to test the Rectangle class with. One is the following:
The second one is the following:
So far this is what I have, and I know it is all wrong. I would appreciate any help you could give me to clean it up:
[ April 21, 2002: Message edited by: Dirk Schreckmann ]