abstract class Graphic
{
private String graphicname;
abstract double area();
abstract double perimeter();
void setName(String gname)
 {
   graphicname=gname;
  }
}

class Circle extends Graphic
{
  double radius;
  double area() {
    return Math.PI * radius * radius;
  }

// Computes the surface area of 	a sphere with radius r.
  double perimeter() {
    return 2.0 * Math.PI * radius;
  }
  Circle(double r)
  {
    radius=r;
  }

}

class Square extends Graphic
{
  private double side;
  double area()
  {
    return side * side;
  }

// Computes the surface area of 	a sphere with radius r.
  double perimeter()
  {
    return 4.0 * side;
  }
  Square(double s)
  {
    side=s;
  }

}








public class Test
{
public static void main(String[] args)
{
System.out.print("请输入半径: ");
ReaderInput input1 = new ReaderInput();
double radius = input1.readDouble();
Circle c1 = new Circle(radius);
System.out.println(); // display	s a blank line
System.out.println("半径 = " + radius);
System.out.println("圆的面积 = " +c1.area());
System.out.println("圆的周长 = " + c1.perimeter());
System.out.println();

System.out.print("请输入边长: ");
ReaderInput input2 = new ReaderInput();
double side = input2.readDouble();
Square s1 = new Square(side);
System.out.println(); // display	s a blank line
System.out.println("边长 = " + side);
System.out.println("正方形的面积 = " +s1.area());
System.out.println("正方形的周长 = " + s1.perimeter());
System.out.println();
}
}

