The purpose of this lab is to
In this lab, you will be implementing two classes - Rectangle and Point.
We will define a rectangle by the coordinates of its four corners. We will also write methods to compute the area and perimeter of a given rectangle from these four points. Your program will prompt for the x- and y-coordinates of the four corners, referred to as "UpperLeft", "LowerLeft", "LowerRight" and "UpperRight".
The description of the classes is as follows:
Point Class
The Point class represents the x- and y-coordinates of a single point in the
coordinate plane. This class is defined in Point.java
. The
Rectangle class will use the Point class to represent each of its four
corners.
Rectangle Class
The Rectangle class represents a rectangle in the coordinate plane. The
Point class is used to store the x- and y-coordinates of its four corners.
This class is defined in Rectangle.java
. The constructor will
have four Point objects as arguments, corresponding to the upperLeft,
lowerLeft, lowerRight, and upperRight corners. The Rectangle class will
also have methods to calculate the length, area, and perimeter of a given
rectangle.