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
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