Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider an array of unique integers salary , where salary[i] is the salary of employee i . Return the average salary of employees, excluding the
Consider an array of unique integers salary
, where salary[i]
is the salary of employee i
. Return the average salary of employees, excluding the minimum and maximum salary. An example is below:
- Input:
salary = {4000,3000,1000,2000}
- Output:
2500.0
In this example, the minimum and maximum salary are 1000
and 4000
, respectively. The average salary, excluding the minimum and maximum salary, is (2000+3000)/2= 2500
.
YOU MAY NOT USE LIBARATY METHODS SUCH AS Math.max
or Math.min
! Complete the method with the signature below.
public static double averageSalary(int[] salary) { ... }
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