//File:  Average2.java
import CSLib.*;
import java.text.DecimalFormat;
public class Average2
{
	public static void main (String [] args)
	{
                InputBox in;
                OutputBox out;
		double number [];
                int n;

                in = new InputBox();
                out = new OutputBox();
	
		in.setPrompt ("How many numbers? ");
		n = in.readInt();
	
		number = new double [n];
		
		//Inputs the numbers into the array
		for (int k=0; k<n; k++)
		{
			in.setPrompt("Next score please: ");
			number [k]= in.readInt();
		}

		//The following code displays the list to the screen
		for (int k=0; k<number.length; k++)
		{
			out.println (number[k]);
		}
		out.println();

		double avg = NumberList.average(number);
		
		DecimalFormat output = new DecimalFormat("0.00");
		out.println ("The average is: " + output.format(avg));
	}
}
