//File: Averaging.java
import CSLib.*;
public class Averaging
{
	public static void main (String [] args)
	{
		//Input the scores
		InputBox in = new InputBox ();
	
		in.setPrompt ("How many scores?");
		int n = in.readInt ();
	
		int [] score = new int [n]; //reserves n contiguous memory locations
										//The index or subscript starts at 0, not 1
	
		for (int k=0; k<n; k++)
		{
			in.setPrompt ("Next score");
			score [k] = in.readInt ();
		}
	
		//Average the scores
		int sum = 0;
		for (int k=0; k<n; k++)
		{
			sum = sum + score [k];
		}
		int avg = sum / n;
		
		//Display the scores
		OutputBox out = new OutputBox ();
		out.println ("The list of scores follows:");
		for (int k=0; k<n; k++)
		{
			out.println (score [k]);
		}
		out.println ();  //double space
	
		//Display the average
		out.println ("The average of the scores is: " + avg);
	}
}
		
