The DataSet class problem

 

Fill in the bodies of the methods in the following class.  Then write a class TestDataSet with a static main method that creates

a DataSet, adds some values, and then prints out the statistics to System.out for verification.

 

 

/**

* Calculates statistical values on a data set where each item is

* entered individually.

*/

public class DataSet

{

    /**

    * Adds a value to the data set

    */

    public void addValueToSet (double newValue)

    {

 

 

 

 

    }

 

    /**

    * Returns the sum of the values currently in the data set.

    */

    public double getSum ()

    {

 

 

    }

 

    /**

    * Returns the average of the values currently in the data set.

    * Precondition: At least one value has been added.

    */

    public double getAverage ()

    {

 

 

    }

 

    /**

    * Returns the maximum value of all values currently in data s et.

    * Precondition: At least one value has been added.

    */

    public double getMaximum ()

    {

 

 

    }

}