Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

apply the cultural gap tool

Answered: 1 week ago

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

What are the differences between dismissal and discharge?

Answered: 1 week ago