import cs1.Keyboard; /** Test the Shape class and its subclasses. @author Greg Vogl last modified 2003-10-14 */ public class ShapeTest { public static void main (String[] args) { // get input System.out.println("Test the Shape class and its subclasses."); System.out.println("Enter the circle radius and press Enter."); double radius = Keyboard.readDouble(); System.out.println("Enter the rectangle width and height and press Enter."); double rectWidth = Keyboard.readDouble(); double rectHeight = Keyboard.readDouble(); System.out.println("Enter the triangle width and height and press Enter."); double triWidth = Keyboard.readDouble(); double triHeight = Keyboard.readDouble(); System.out.println("Enter the square x, y and side and press Enter."); double squareX = Keyboard.readDouble(); double squareY = Keyboard.readDouble(); double squareSide = Keyboard.readDouble(); // create shapes CircleShape circle = new CircleShape(radius); RectangleShape rectangle = new RectangleShape(rectWidth, rectHeight); RightTriangleShape triangle = new RightTriangleShape(triWidth, triHeight); SquareShape square = new SquareShape(squareX, squareY, squareSide); // output results System.out.println(circle); System.out.println(rectangle); System.out.println(triangle); System.out.println(square); } }