public class DataSet
{
    private int sum;
    private int numberOfValues;

    /**
     * Constructs an empty dataset
     */
    public DataSet()
    {
        sum = 0;
        numberOfValues = 0;
    }

    /**
     * Constructs a dataset with the specified initial value
     * @param initialValue the first value in the dataset
     */
    public DataSet(int initialValue)
    {
        sum = initialValue;
        numberOfValues = 1;
    }

    /**
     * Adds the specified value to this dataset
     * @param value the value to add
     */
    public void addValue(int value)
    {
        sum += value;
        numberOfValues++;
    }

    /**
     * Returns the sum of all values in this dataset
     * @return the sum of all values in this dataset
     */
    public int getSum()
    {
        return sum;
    }

    /**
     * Returns the average of all values in this dataset
     * @return the average of all values in this dataset
     */
    public double getAverage()
    {
        return sum / (double) numberOfValues;
    }
}
