FileDocCategorySizeDatePackage
Main.javaAPI DocExample412Sat Apr 28 10:22:46 BST 2001None

Main.java

import java.util.*;

/** Part of a main program using Shape objects */
public class Main {

	Collection allShapes;	// created in a Constructor, not shown

	/** Iterate over all the Shapes, getting their areas */
	public double totalAreas() {
		Iterator it = allShapes.iterator();
		double total = 0.0;
		while (it.hasNext()) {
			Shape s = (Shape)it.next();
			total += s.computeArea();
		}
		return total;
	}
}