// Clara Choi - Lab 3 -  3/10/2005
// Source File Name:   ExamData.java

import java.io.*;
import java.util.Random;

public class ExamData
{
    static final int numOfStudent = 200; // number of times to generate data
    static int mark;
    static double avg = 0;
    static PrintWriter output; //output buffer

    public static void main (String args[]) throws IOException
    {
	output = new PrintWriter (new FileWriter ("ExamData.out"));
	Random random = new Random ();

	for (int i = 1 ; i <= 200 ; i++)
	{
	    mark = 0;
	    for (int j = 1 ; j <= 10 ; j++)
	    {
		mark += random.nextInt (11);    //randomize a number 0 - 10 and add them up
	    }
	    output.println (mark);
	    avg = avg + mark;
	}
	output.close ();

	avg = (double) avg / numOfStudent;
	System.out.println ("Mark Generations done..."); //inform you that it's done
	System.out.print ("Average of marks generated: ");
	System.out.println (avg);
    }
}
