|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectRectangle
public class Rectangle
A class that manages a rectangle given the length and width.
| Field Summary | |
|---|---|
private double |
length
|
private double |
width
|
| Constructor Summary | |
|---|---|
Rectangle()
Create a new rectangle object with length and width = 1.0 |
|
Rectangle(double rLength,
double rWidth)
Create a new rectangle object given the length and width of the rectangle. |
|
| Method Summary | |
|---|---|
double |
getArea()
Return the area of the rectangle. |
double |
getLength()
Return the length of the rectangle. |
double |
getPerimeter()
Return the perimeter of the rectangle. |
double |
getWidth()
Return the width of the rectangle. |
void |
setLength(double newLength)
Change the length of the rectangle to the new length given |
void |
setWidth(double newWidth)
Change the width of the rectangle to the new width given |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private double length
private double width
| Constructor Detail |
|---|
public Rectangle()
public Rectangle(double rLength,
double rWidth)
rLength - length of the rectangle. Must be greater than 0.rWidth - width of the rectangle. Must be greater than 0.| Method Detail |
|---|
public double getLength()
public double getWidth()
public double getPerimeter()
public double getArea()
public void setLength(double newLength)
newLength - length of the rectangle. Must be greater than 0public void setWidth(double newWidth)
newWidth - width of the rectangle. Must be greater than 0
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||