import rebelsky.io.SimpleOutput; // We'll be printing results import Computations; // We'll be computing /** * Perform a series of computations (sum, minimum, maximum, average) * on an array of numbers. To change the array of numbers, you'll need * to change the code for this program and recompile. * * @author Samuel A. Rebelsky * @author YOUR NAME HERE * @version 1.1 of March 1998 */ public class UseComputations { // +------+-------------------------------------------------------------- // | Main | // +------+ public static void main(String[] args) { // Prepare for writing output SimpleOutput out = new SimpleOutput(); // Create an array to compute with double[] values = { 3.2, 4.4, 5, 2, 1, 9, 0, -4 }; // Create an object of this type so that we can do some // computations. Computations comp = new Computations(); // Print the array. out.print("Working with the array: "); out.println(values); // Print the various computed values out.print("The average of those values is: "); out.println(comp.average(values)); out.print("The largest of those values is: "); out.println(comp.maximum(values)); out.print("The smallest of those values is: "); out.println(comp.minimum(values)); out.print("The sum of those values is: "); out.println(comp.sum(values)); // That's it. We're done. System.exit(0); } // main } // UseComputations