public class Rectangle
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private LineSegment |
ls1
A Rectangle is defined by two line segments that have a common end-point.
|
private LineSegment |
ls2
A Rectangle is defined by two line segments that have a common end-point.
|
| Constructor and Description |
|---|
Rectangle(LineSegment ls1,
LineSegment ls2)
A constructor for the Rectangle object.
|
| Modifier and Type | Method and Description |
|---|---|
double |
area()
Method to compute the area of 'this' Rectangle
|
boolean |
equals(java.lang.Object obj)
Method to compare 'this' Rectangle segment for equality with the 'object' specified
as a parameter.
|
LineSegment |
getLs1()
Getter for LineSegment 1
|
LineSegment |
getLs2()
Getter for LineSegment 2
|
double |
perimeter()
Method to compute the perimeter of 'this' Rectangle
|
java.lang.String |
toString()
Method to render 'this' instance of the Square class into a String.
|
private LineSegment ls1
private LineSegment ls2
public Rectangle(LineSegment ls1, LineSegment ls2) throws LineSegmentsNotPerpendicularException, LineSegmentsNotAdjacentException
ls1 - The first LineSegment defining the rectanglels2 - The second LineSegment defining the rectangleLineSegmentsNotPerpendicularException - This exception is thrown if the
two LineSegments are not perpendicular to each otherLineSegmentsNotAdjacentException - This exception is thrown if the
LineSegments do not share a common end-point.public double area()
public double perimeter()
public LineSegment getLs1()
public LineSegment getLs2()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - An Object to be tested for equality with 'this' Rectanglepublic java.lang.String toString()
toString in class java.lang.Object