Question: Write a static method named median that accepts three integers as parameters and that returns the middle value of the three. For example, median(7, 3,

Write a static method named median that accepts three integers as parameters and that returns the middle value of the three. For example, median(7, 3, 9) returns 7 and median(29, -14, 11) returns 11.

Test your code with the following class:

public class TestMedian {

public static void main(String[] args) {

System.out.println(median(7, 3, 9)); // 7

System.out.println(median(29, -14, 11)); // 11

System.out.println(median(752, 64, 121)); // 121

}

// your code goes here

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!