Class Rectangle

java.lang.Object
  |
  +--Rectangle

public class Rectangle
extends java.lang.Object

A class that manages a rectangle given the length and width.


Constructor Summary
Rectangle(double length, double width)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rectangle

public Rectangle(double length,
                 double width)
Create a new rectangle object given the length and width of the rectangle.
Parameters:
length - length of the rectangle. Must be greater than 0.
width - width of the rectangle. Must be greater than 0.
Method Detail

getLength

public double getLength()
Return the length of the rectangle.
Returns:
the length of the rectangle.

getWidth

public double getWidth()
Return the width of the rectangle.
Returns:
the width of the rectangle.

getPerimeter

public double getPerimeter()
Return the perimeter of the rectangle.
Returns:
the perimeter of the rectangle.

getArea

public double getArea()
Return the area of the rectangle.
Returns:
the area of the rectangle.