id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

crehwinkel@frhsd.com introcs_array_problems > almostAverage
prev  |  next  |  chance

Write a method called almostAverage which receives an array of integers as an input and returns the average of the array of integers without the maximum or minimum values of the array included in the average. For example if almostAverage was passed the array [2,4,200, 6] the largest and smallest values are ignored and the average would be calculated as 5.0 ( (4+6)/2 ).


almostAverage([2, 4, 200, 6]) → 5.0
almostAverage([1, 500, 10, 11, 12]) → 11.0
almostAverage([300, 20, 30, 40, 50, 60, -3]) → 40.0

...Save, Compile, Run (ctrl-enter)

public double almostAverage(int [] arr){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy