/* T02n01.java -- Our first step-counting example. In the `average' method, * each operation has an associated increment of the operation counting * variable. The counter, o, is global with the idea that it could be * used in other methods without having to add a variable declaration * to each, plus we don't have to worry about returning it from a method * that already needs to return something as part of its normal * operation. */ import java.io.*; public class T02n01 { public static int o = 0; // operation counter public static double average (double [] list, int n) { double mean; double sum = 0; o++; o++; for (int i=0; i