Question: You are to write the following 4 methods: public static double max(double [] data) - return the maximum value in the array. public static double

You are to write the following 4 methods:

public static double max(double [] data) - return the maximum value in the array.

public static double min(double [] data) - return the minimum value in the array

public static double sum(double [] data) - sum the items in the array and return the result

public static double ave(double [] data) - call sum to get the sum and then return the average

Once you have completed the methods above, write a simple main program that does the following:

1) Asks the user how many items will be entered

2) Creates an array of double of the correct size

3) Fills the array with randomly generated values

4) Calculates and prints out max, min, sum and average using the methods above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!