/* * Just a main program for testing our objects */ class Tester { // The main program public static void main (String args[]) { //*6 Main program /* * Data definitions */ Rect r1, r2; //*1 Data definitions Circle c1; //*1 /* * Instantiate the objects (could have done in defs above) */ r1 = new Rect (); //*2 Instantiate r2 = new Rect (); //*2 c1 = new Circle (); //*2 /* * Set the locations of the 3 objects */ r1.x = 10; r1.y = 10; //*3 Set locations r1.wid = 50; r1.ht = 50; //*3 r2.x = 80; r2.y = 10; //*3 r2.wid = 10; r2.ht = 100; //*3 c1.x = 35; c1.y = 90; //*3 c1.rad = 10; //*3 /* * "Draw" them */ r1.draw(); //*4 Draw them r2.draw(); //*4 c1.draw(); //*4 /* * Compute and print total area */ System.out.println ("Total area = " + //*5 Compute and print area (r1.area() + r2.area() + c1.area())); //*5 } }