/* * Rectangle.java *  * Version: *     $Id: Rectangle.java,v 1.8 2004/09/28 02:16:01 vcss231 Exp $ * * Revisions: *     $Log: Rectangle.java,v $ *     Revision 1.8  2004/09/28 02:16:01  vcss231 *     use only the solution, since now students won't be fixing * *     Revision 1.3  2001/09/28 15:56:55  cs1 *     Made all declarations one per line and commented data members * *     Revision 1.2  2000/09/18 19:12:44  cs1 *     Modified the javadoc comments to meet standards - lrr * *     Revision 1.1  2000/09/14 17:34:21  cs1 *     Initial revision * *//** * A class that manages a rectangle given the length and width. * * @author     Paul Tymann * */public class Rectangle {    private double length = 1.0; 		// The length of this Rectangle    private double width = 1.0;		// The width of this Rectangle    /**     * Create a new rectangle object with length and width = 1.0          */    public Rectangle() {    }    /**     * Create a new rectangle object given the length and width of the     * rectangle.     *     * @param    rLength  length of the rectangle.  Must be greater than 0.     * @param    rWidth   width of the rectangle.  Must be greater than 0.     */    public Rectangle( double rLength, double rWidth ) {	length = rLength;	width = rWidth;    }    /**     * Return the length of the rectangle.     *     * @return   the length of the rectangle.     */    public double getLength() {	return length;    }    /**     * Return the width of the rectangle.     *     * @return   the width of the rectangle.     */    public double getWidth() {	return width;    }    /**     * Return the perimeter of the rectangle.     *     * @return   the perimeter of the rectangle.     */    public double getPerimeter() {	return 2 * ( length + width );    }    /**     * Return the area of the rectangle.     *     * @return   the area of the rectangle.     */    public double getArea() {	return length * width;    }    /**     * Change the length of the rectangle to the new length given     *     * @param    newLength  length of the rectangle.  Must be greater than 0     */    public void setLength( double newLength ) {	length = newLength;    }    /**     * Change the width of the rectangle to the new width given     *     * @param    newWidth  width of the rectangle.  Must be greater than 0     */    public void setWidth( double newWidth ) {	width = newWidth;    }} // Rectangle