Question: In java Complete the following DataSet class by filling in the implementations for the class constructor, sum(), average(), max(), min(), and standardDeviation() methods. The constructor
In java
Complete the following DataSet class by filling in the implementations for the class constructor, sum(), average(), max(), min(), and standardDeviation() methods. The constructor should initialize the class data array to the array reference that is passed to the constructor as a parameter.
The below formula may be helpful for computing the standard deviation.
importjava.util.*
;publicclassDataSet{
privateint[]data;
publicDataSet(int[]d){
//constructor method
}
//add the remaining methods
}//endofclass
Complete the following RunDataSet class, where you will:
- Declare an array of integers, size 15. [or obtain the size from the user]
- Obtain the array values from the user using a loop.
- Create an object of the DataSet class and send the array reference as an argument to the constructor.
- Call the DataSet methods to display the sum, average, max, min, and standard deviation of the array.
publicclass RunDataSet
{
publicstaticvoid main(String[] args) {
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
