public class Rectangle1 {

// the instance fields - width and height
  int width;
  int height;

// The constructor for rectangle.
//   receives two parameters: width and height

  public Rectangle1(int x, int y) {
    width = x;
    height = y;
  }

// a public method to obtain area
  public int area() {
    return width*height;
  }

// a public method to obtain perimeter
  public int perimeter() {
    return 2 * (width + height);
  }

// a public method to determine if this rectangle is a square
  public boolean amIaSquare() {
    return (width == height);
  }

// a public method to print descriptive information about me
  public void describe() {
    System.out.print("I am " + this.toString() + ". ");
    System.out.print("My area is " + area() + ". ");
    System.out.print("My perimeter is " + perimeter() + ". ");
    if (amIaSquare() )
      System.out.println("I am a square.");
    else
      System.out.println("I am a rectangle.");
  }

// The following is an added method which allows this class file to
// be executed as a java program.  It would not be included in a
// normal class definition file

  public static void main(String args[]) {
    Rectangle1 r1 = new Rectangle1(11, 13); //construct a 11x13 rectangle
    Rectangle1 r2 = new Rectangle1(17, 17); //construct a 17x17 square

   r1. describe();
   r2. describe();
  }

}
