Question: Write a function called centeredAverage that takes two parameters: an array of integers and the number of elements in the array and returns the centered

Write a function called centeredAverage that takes two parameters: an array of integers and the number of elements in the array and returns the "centered" average of the array.
Define the "centered",average to mean the floating point average of the values, except ignoring a single occurrence of the largest and'smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for the largest value. You may assume that the array is of length 3 or more.
centeredAverage ({1,100,3,4,2},5) returns 3.0(ignore1 and 100)
centeredAverage ({1,1,5,5,10,8,7},7) returns 5.2(ignore1 and 10)
centeredAverage ({-10,-4,-2,-4,-2,0},6) returns -3.0(ignore0 and -10)
Write the entire function below, including the function header.
Note : In the examples above of calling the function, the values within curly brackets {} indicate an input array parameter.
Write a function called centeredAverage that

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 Programming Questions!