// array of objects

class Rect {
    private int w;
    private int h;
    public Rect(int w, int h) {	this.w = w; this.h = h; }
    public int getArea() { return w*h; }
}

public class arrayOfObjects_sol {
    public static void main(String[] args) {
	
	final int SIZE = 5;
	int i = 0;

        Rect[] r = new Rect[SIZE];
	
        r[i] = new Rect(1,2);
	
	// draw boxscope diagram
	
	// Make lots more Rects of random size:
	for(i=1 ; i < SIZE ; i++)
	    r[i] = new Rect(
			    (int) (Math.random()*3+1), 
			    (int) (Math.random()*3+1)
			    );

	// Find and print the total area for all created Rects:
	// (fill in missing code)
	int area = 0;
	for(i=1 ; i < SIZE ; i++)
	    area += r[i].getArea();

	System.out.println("The total area is " + area);

    }

}