public class Rectangle extends Shape
Constructor and Description |
---|
Rectangle()
Construct a Rectangle object using the default size
for its dimensions.
|
Rectangle(double theLength,
double theHeight)
Construct a Rectangle object using the arguments.
|
Rectangle(Rectangle x)
This is the copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Returns true if and only if the argument is not
null and is a Rectangle object that
has the same length and height as this Rectangle.
|
double |
getHeight()
Get the height dimension of this Rectangle.
|
double |
getLength()
Get the length dimension of this Rectangle.
|
double |
getPerimeter()
Get the perimeter of this Rectangle.
|
double |
getSurfaceArea()
Get the surface area of this Rectangle.
|
void |
setHeight(double theHeight)
Set the height dimension of this Rectangle.
|
void |
setLength(double theLength)
Set the length dimension of this Rectangle.
|
java.lang.String |
toString()
Returns a String object representing this
Rectangle's value.
|
getShapeName
public Rectangle()
public Rectangle(double theLength, double theHeight)
theLength
- the length of this Rectangle;
must be > 0theHeight
- the height of this Rectangle;
must be > 0public Rectangle(Rectangle x)
x
- is the Rectangle to be duplicated.public double getSurfaceArea()
getSurfaceArea
in class Shape
public double getPerimeter()
getPerimeter
in class Shape
public double getLength()
public double getHeight()
public void setLength(double theLength)
theLength
- new length of this Rectangle;
must be > 0public void setHeight(double theHeight)
theHeight
- the new height of this Rectangle;
must be > 0public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- is the object to be compared with.