Question: Write a method called average InRange() that takes in a list of Integer objects as a parameter, together with two additional int values, low
Write a method called average InRange() that takes in a list of Integer objects as a parameter, together with two additional int values, low and high. This method should return the average of all numbers in the list that lie between the low and high values, inclusive. Return zero if the list is null or no values are within the specified range. Examples: averageInRange(list(1, averageInRange(list(1, averageInRange(list(1, 2, 3, 4, 5, 6, 7), 0, 10) -> 4 2, 3, 4, 5), 2, 4) -> 3 2, 3), 0, 0) -> 0 1 public int averageInRange(List nums, int low, int high) 2 {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
