import java.io.*; public class PolyApplication { public static void main (String args[]) throws IOException { // (ii) System.out.println ( " Please, type in one of the following :"); System.out.println ( " \t\tShape"); System.out.println ( " \t\tCircle"); System.out.println ( " \t\tRectangle"); System.out.println ( " \t\t============"); // (iii) BufferedReader stdin = new BufferedReader( new InputStreamReader (System.in)); String choice = stdin.readLine(); // (iv) Shape s; if ((choice.equals("Shape")) || (choice.equals("shape"))) s = new Shape(10, 10); else if ((choice.equals("Circle")) || (choice.equals("circle"))) s = new Circle(20, 20, 20); else if ((choice.equals("Rectangle")) || (choice.equals("rectangle"))) s = new Rectangle(30,30,30,30); else s = new Shape(100, 100); s.drawShape(); } } class Shape { protected int x, y; Shape (int x, int y) { this.x = x; this.y = y; } // Shape (int x, int y) public void drawShape () { System.out.println ("Shape : " + "x=" + x + " y=" + y +"."); } // public void drawShape () } // class Shape class Circle extends Shape { private int radius; Circle (int x, int y, int radius) { super (x, y); this.radius = radius; } // Circle (int x, int y, int radius) public void drawShape () { System.out.println ("Circle : " + "x=" + x + " y=" + y + " radius=" + radius + "."); } // public void drawShape () } // class Circle extends Shape class Rectangle extends Shape { private int width, height; Rectangle (int x, int y, int width, int height) { super (x, y); this.width = width; this.height = height; } // Rectangle (int x, int y, int width, int height) public void drawShape () { System.out.println ("Rectangle : " + "x=" + x + " y=" + y + " width=" + width + " height=" + height + "."); } // public void drawShape () } // class Rectangle extends Shape