In some Olympic competitions a competitor's score is determined by a panel of judges who each award a score to the competitor. To discount biased judges or statistical outliers the maximal and minimal scores are dropped, then the average of the remaining scores, the average without the two extremes, is the final score awarded.
Write a method getScore that returns the average score after dropping the lowest and highest scores.
[4.0, 10.0, 5.0] Returns: 5.0After throwing out the high/low scores only 5.0 is left.
[8.0, 8.0, 8.0, 8.0] Returns: 8.0
[1.75, 1.0, 2.0, 2.25, 1.75, 2.2 ] Returns: 1.925 1.75 + 2.0 + 1.75 + 2.2 = 7.7 7.7/4 = 1.925