Question: 6.4.6 Find the Median Please complete the code in Java 6.4.6: Find the Median Save Submit + Continue RUN CODE | TEST CASES ASSIGNMENT DOCS
6.4.6 Find the Median
Please complete the code in Java

6.4.6: Find the Median Save Submit + Continue RUN CODE | TEST CASES ASSIGNMENT DOCS | GRADE MORE 5 points Status: Not Submitted 1 import java.util.*; 2 public class Median 3- { 4 5 public static void main(String[] args) 6- { 7 int[] numbers1 {12, 75, 3, 17, 65, 22}; System.out.print("The median value of the EVEN array is Write a method called median that returns the median value in the array. If the length of the array is odd, the median is the value in the center of the array. = 89 + median(numbers1)); If the length of the array is even, the median is the average of the two numbers in the center. int[] numbers2 = {12, 75, 3, 17, 65, 22, 105}; System.out.print(" The median value of the ODD array is You may assume the array passed into this method will never be empty. + median(numbers2)); Sample output: } 10 11 12 13 14 15 16 17 18 19 } The median value of the EVEN array is 19.5 The median value of the ODD array is 22.0 public static double median(int[] arr) { // your code goes here! } Hint: We've imported java.util.* for you, so you have a handy static method on Arrays that you can use called Arrays.sort so you can sort your method BEFORE finding the median
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
