package shapes; public class ShapeTester { public static void main(String[] args) { System.out.println("ShapeTester written by S. Robbins"); // Shape badShape = new Shape("Nice Shape"); Shape[] myShapes = new Shape[5]; myShapes[0] = new Circle("Circle", 3); myShapes[1] = new Rectangle("Rectangle", 3, 4); myShapes[2] = new Square("Square", 6); myShapes[3] = new Rectangle("Another Rectangle", 4, 5); myShapes[4] = new Circle("Circle", 5); System.out.println("5 shapes have been created:"); for (int i = 0; i < myShapes.length; i++) System.out.println(i + ": " + myShapes[i]); System.out.println("The following are circles:"); for (int i = 0; i < myShapes.length; i++) if (myShapes[i] instanceof Circle) System.out.println(myShapes[i]); System.out.println("Shape 2 compared to chape 3 gives: " + myShapes[2].compareTo(myShapes[3])); System.out.println("Shape 3 compared to chape 2 gives: " + myShapes[3].compareTo(myShapes[2])); } }