interface Shape {
    double Area();
    final double pi = 3.14159;
}

class Rectangle implements Shape {
    int width;
    int height;

    Rectangle(int w, int h) {
	this.width = w;
	this.height = h;
    }

    public double Area() {
	return (width * height);
    }

 
    public int Perimeter () {
	return (2 * width + 2 * height);
    }
   
    public String toString() {
	String str1 = "I am a rectangle of width " +
	    width + " and height " + height + " and of area "+
	    this.Area() + ". Also my perimeter is " + 
	    this.Perimeter() + " If I call Object's toString(), I get "+
	    super.toString();
	return str1;
    }
    

}

class Square extends Rectangle {
    Square(int side) {
	super(side, side);
    }
}


class Circle implements Shape {
    int radius;

    Circle(int r) {
	this.radius = r;
    }

    public double Area() {
	return (pi * radius * radius);
    }

    public String toString() {
	String str1 = "I am a circle of radius " +
	    radius + " and of area "+
	    this.Area();
	return str1;
    }
}


public class Demo1 {
    public static void main(String args[]) {
	System.out.println("hello world");
	Rectangle rect1 = new Rectangle(10, 20);
	Rectangle rect2 = new Rectangle(5, 10);
	System.out.println(rect1.toString());
	System.out.println(rect2);
	Square sqr1 = new Square(7);
	System.out.println(sqr1);
	Circle cir1 = new Circle(3);
	System.out.println(cir1);
    }
}

