/*
* Just a main program for testing our objects
*/
class Tester {
// The main program
public static void main (String args[]) {
/*
* Data definitions
*/
Rect r1, r2;
Circle c1;
/*
* Instantiate and initialize the objects
* (could have done in defs above)
*/
r1 = new Rect (10, 10, 50, 50); //*1 Use constructors
r2 = new Rect (80, 10, 10, 100); //*1
c1 = new Circle (35, 90, 10); //*1
/*
* "Draw" them
*/
r1.draw();
r2.draw();
c1.draw();
/*
* Compute and print total area
*/
System.out.println ("Total area = " +
(r1.area() + r2.area() + c1.area()));
}
}