import java.io.*;
/**
 * @interface Rectangle
 * @author Bina Ramamurhty
 * Description: Defines the Rectangle interface
 * @see Rectangle.java
 * @date 9/3/2000
 */
public interface Rectangle 
{
   public int area();
   public int perimeter();
}


/**
 * @class RectangleImpl1
 * @author Bina Ramamurthy
 * Description: An implementation of Rectangle interface
 * @see Rectangle.java , RectangleImpl1.java
 * @data 9/3/2000
 */
class RectangleImpl1 implements Rectangle
 {
 
    private int width;
    private int length;
 
    // constructors
    public RectangleImpl1(){};
    public RectangleImpl1(int wid, int len) { length = len; width =
							       wid;}


    // set and get methods
    public void setLength (int len) { length = len;}
    public void setWidth (int wid) { width = wid;}

    public int getLength() { return length;}
    public int getWidth() {return width;}

    // predicate method
    public boolean  isItSquare()
    { return (length == width);}

    // service or interface methods
    public int area () { return length * width;}
    public int perimeter() { return 2*(length + width);}
 
    // utility method
    public String toString()
    {
       StringBuffer buf = new StringBuffer();
       
       buf.append("This is a Rectangle" + "\n");
       buf.append("The length is " + length + "\n");
       buf.append("The width is " + width + "\n");
       buf.append("The area is " + area() + "\n");
       buf.append("The perimeter is  " + perimeter() + "\n");

       return buf.toString();
    }
 }


 class RectangleClient
 {
    public static void main(String args[])
    {
       RectangleImpl1 r = new RectangleImpl1();
       r.setWidth(24);
       r.setLength(30);
       System.out.println(r);
    }
 }
