Out: Tue 17 Feb 1998 Due: During Lab Session
Programming Assignment:
Write, compile and run the Statistics.java program
to calculate the average and standard deviation of a collection of
numbers.
The example program MySecondObject.java
will serve as a model. You will also need to input double values
using the technique demonstrated in Temperature.java.
Note: The import java.io.* ;
must be at the top of your Statistics.java,
and the throws IOException must follow the
line declaring main, exactly as in Temperature.java.
The formula are:
average = total / n ; variance = ( sqrTotal - ( total*total )/n ) / (n-1) ; standardDeviation = Math.sqrt(variance) ;where n numbers have been entered, the sum of those numbers is total and the sum of the squares of those numbers is sqrTotal.
Here is a sample run:
appomattox> javac Statistics.java appomattox> java Statistics How many numbers? 3 Enter value: .2 Enter value: .3 Enter value: .6 3 numbers entered. Their average is 0.3666666666666667 Their standard deviation is 0.2081665999466132 appomattox>
Use PostIt to submit your homework. There are further instructions about how to do this.