Question: Write a method named average: Write a method named median which calculate, and return, the average of an array of integers. The method should receive

Write a method named average: Write a method named median which calculate, and return, the average of an array of integers. The method should receive as parameters, an array of integers and the filled size of the array. Your method should assume that the array will contain some positive integers, filled in ascending order. This is a partially-filled array, where the number of items in the array may be less than the declared size of the array. The size parameter tells the method how many items are actually stored in the array. The average should be calculated as a double value.

Starter Code:

public class CalculateAverage {

/**

* Calculates the average of the integers in array 'list'

* @param list The array containing the integers for which to calculate the average

* @param size The number of integers in array 'list'

* @return The average of the integers in the array

*/

public static double average(int [] list, int size) {

return 0;

}

}

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!