import java.io.PrintStream; import franck.cse5910.HasVolume; import franck.cse5910.Shape; import franck.cse5910.ShapeCollection; public class PrintVolume { public static void main(String[] args) { PrintStream output = System.out; double total = 0; ShapeCollection collection = ShapeCollection.getRandom(); for (Shape shape : collection) { if (shape instanceof HasVolume) { total += ((HasVolume) shape).getVolume(); } } output.printf("%.2f%n", total); } }