UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ Scores1.java
public class Scores1{

    private int count;
    private double[] scores;

    public Scores1(int max) {
        count = 0;
        scores = new double[max];
    }

    public void add(double score) {
        scores[count] = score;
        count++;
    }

    public double getAverage() {
        double sum=0.0;
        for (int i=0; i<count; i++){
            sum += scores[i];
        }
        return sum/count;
    }

    public static void main (String [] args) {
        Scores1 scores = new Scores1(20);
        for (int i=0; i<20; i++){
            scores.add(i);
            System.out.println(scores.getAverage());
        }
    }
}