Question
/** * Code for E7.9 * This class computes various statistics from a set of data values in an array. * @author */ public class
/** * Code for E7.9 * This class computes various statistics from a set of data values in an array. * @author */ public class DataSet { private double[] data; private int dataSize; private int maximumNumberOfValues;
/** Constructs an empty data set. @param maximumNumberOfValues the maximum this data set can hold */ public DataSet(int maximumNumberOfValues) { data = new double[maximumNumberOfValues]; }
/** Adds a data value to the data set if there is a room in the array. @param value a data value */ public void add(double value) { // Complete this method. Don't forget to ignore the input if the array is full. . . . }
/** Gets the sum of the added data. @return sum of the data or 0 if no data has been added */ public double getSum() { // Complete this method . . . }
/** Gets the average of the added data. @return average of the data or 0 if no data has been added */ public double getAverage() { // Complete this method . . . }
/** Gets the maximum value entered. @return maximum value of the data NOTE: returns -Double.MAX_VALUE if no values are entered. */ public double getMaximum() { // Complete this method . . . } }
Please use the template provided above using intermediate java.
E7.9 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 alue) Practice Exercises 36 that adds a value, provided there is still room Provide methods to compute the sum, average, maximum, and minimum value
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started