Question: Write a JAVA program that includes two methods named calcvaerage () and variance (). The clacaverage () method should calculate and return the average of
Write a JAVA program that includes two methods named calcvaerage() and variance(). The clacaverage() method should calculate and return the average of the values stored in the array named testvals. This array should be declared in the main() and should hold double type 15 values. These values are input by the user when the program is run. The variance() method should calculate and return the variance of the data stored in the testvals array. The variance is obtained by subtracting the average from each value in testvals, squaring these differences, adding them, and dividing this sum by number of elements in testvals. The values obtained from calcaverage() and variance() should be displayed using println statements within the main() function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
