/** * Perform a series of computations (sum, minimum, maximum, average) * on an array of numbers. * * @author Samuel A. Rebelsky * @author YOUR NAME HERE * @version 1.1 of March 1998 */ public class Computations { // +---------+----------------------------------------------------------- // | Methods | // +---------+ /** * Compute the average value in an array of numbers. */ public double average(double[] stuff) { // The instructions for this method need to be filled in return 0; } // average(double[]) /** * Compute the maximum value in an array of numbers. */ public double maximum(double[] stuff) { // The instructions for this method need to be filled in return 0; } // maximum(double[]) /** * Compute the minimum value in an array of numbers. */ public double minimum(double[] stuff) { // The instructions for this method need to be filled in return 0; } // minimum(double[]) /** * Compute the sum of values in an array of numbers. */ public double sum(double[] stuff) { // The total of the values. Initially 0, since we haven't // seen any values. double total = 0; // A counter to step through the array. int i; // Step through the array, updating the total as we go. for(i = 0; i < stuff.length; i = i + 1) { total = total + stuff[i]; } // That's it, we're done. return total; } // sum(double[]) } // Computations