Question: Eclipse Java Neon Write a class DataSet that stores a number of values of type double. Provide a constructor public DataSet(int maximumNumberOfValues) and a method
Eclipse Java Neon
Write a class DataSet that stores a number of values of type double. Provide a constructor
public DataSet(int maximumNumberOfValues)
and a method
public void add(double value)
that adds a value, provided there is still room
Provide methods to compute the sum, average, maximum, and minimum value.
Heres what I need to use:
public class DataSet
{ // Implmentation . . .
/** Constructs an empty data set. @param maximumNumberOfValues the maximum this data set can hold */ public DataSet(int maximumNumberOfValues) { . . . }
/** Adds a data value to the data set if there is room in the array. @param value a data value */ public void add(double value) { . . . }
/** Gets the sum of the added data. @return sum of the data or 0 if no data has been added */ public double getSum() { . . . }
/** Gets the average of the added data. @return average of the data or 0 if no data has been added */ public double getAverage() { . . . }
/** Gets the maximum value entered. @return maximum value of the data NOTE: returns -Double.MAX_VALUE if no values are entered. */ public double getMaximum() { . . . }
/** Gets the minimum value entered. @return minimum value of the data NOTE: returns Double.MAX_VALUE if no values are entered. */ public double getMinimum() { . . . } }
Thank you!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
