// Rect.java
// Rectangle class definition
// package statement creates jre-classes-edu-lehigh-notes directory tree
package edu.lehigh.notes;
public class Rect {
	private double length;
	private double width;

	// Constructor method
	public Rect( double l, double w ) {
		length = setLength( l );
		width = setWidth( w );
	}

	// Set methods
	public double setLength( double l ) {
		if( l < 0.0 || l > 20.0 )
			l = -1.0;

		return l;
	}

	public double setWidth( double w ) {
		if( w < 0.0 || w > 20.0 )
			w = -1.0;

		return w;
	}

	public double getLength( ) {
		return length;
	}

	public double getWidth( ) {
		return width;
	}

	public double perim( ) {
		double p = 2 * length + 2 * width;
		return p;
	}

	public double area( ) {
		double a = length * width;
		return a;
	}
}