/**
 * Title: Rectangle Class
 *
 A class that has attributes "length" and "width" that default to 1, 
 with methods to calculate the perimeter and area of the rectangle.

 It also includes 'set' and 'get' methods for user input and feedback...
 *
 */
class recta {
    float width;
    float length;
    
    recta () {
        width = 1;
        length = 1;
    }

    recta (float w, float h){
        width = w;
        length = h;
    }

    float perimeter() {
        return width * 2 + length * 2 ;
    }

    float area() {
        return width * length;
    }
    
    void setWidth (float w) throws Exception {
        if ((w > 0.0) && (w < 20.0))
           width = w;
        else 
            throw new Exception("Width must be between 0.0 and 20.0");
    }

    void setLength (float h) throws Exception {
        if ((h > 0.0) && (h < 20.0))
            length = h;
        else 
            throw new Exception("Length must be between 0.0 and 20.0");
    }
    
    float getLength () {
        return length;
    }

    float getWidth () {
        return width;
    }
}


       

