import java.util.Scanner;

/*************************************************************
 * StdDev will read a command line argument and use it to 
 * determine how many values to read into an array. It will
 * then calculate the mean and standard deviation of the array.
 *
 * @author Nancy Harris
 * @version 1
 *************************************************************/
 public class StdDev
 {
 	/*********************************************************
	 * main method will read the values in and print the 
	 * mean and std deviation
	 * 
	 * @param args command line arguments - supply the number 
	 *        of values to read in
	 ********************************************************/
 	public static void main (String args [])
	{
		final int	DEFAULT_SIZE = 25;
		
		Scanner	keyboard;
		double[]	numbers;
		int 		size;
		double 	mean;
		double 	stdDev;
		
		keyboard = new Scanner(System.in);
		
		// solve first problem, getting the size from
		// argument list
		if (args.length > 0)
			size = Integer.parseInt(args[0]);
		else
			size = DEFAULT_SIZE;
			
		// solve the second problem. Read and store the 
		// numbers
		
		numbers = new double [size];
		
		for (int ii = 0; ii < numbers.length; ii++)
		{
			numbers[ii] = keyboard.nextDouble();
		}
	
		// solve the third problem. Calc the mean
		// must pass an array to that method
		mean = StdDeviationHelper.mean(numbers);
		
		
		// finally solve the fourth problem. Calc the std
		// deviation once we can calc the mean.
		stdDev = StdDeviationHelper.stdDev(numbers);
		
		// print result
		System.out.printf("Mean: %.2f\n", mean);
		System.out.printf("Standard Deviation: %.2f\n", stdDev);
	}
}
		