StatisticsDriver - public static void main (String args) {...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // StatisticsDriver.java Author: Lewis and Loftus // // Solution to Programming Project 6.6 // //******************************************************************** / import java.util.Random; import java.text.DecimalFormat; i public class StatisticsDriver { private static final int NUM = 50, MAX = 20, NUM_CYCLES = 5; //----------------------------------------------------------------- // Demonstrates the mean and standard deviation methods //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public static void main (String args) { DecimalFormat formatter = new DecimalFormat("#0.00"); Random gen = new Random(); int numbers = new int[NUM]; int j; for (int i=0; i<NUM_CYCLES; i++) { // create random numbers for (j=0; j<NUM; j++) numbers[j] = gen.nextInt(MAX) + 1; System.out.println("\n\nCycle " + (i+1) + "\n-----------------------------"); System.out.println("The mean : " + formatter.format(Statistics.mean(numbers))); System.out.println("The standard deviation: " + formatter.format(Statistics.standardDeviation(numbers))); } } }...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online