Question: Write a program to help students practice median. Write a program to generate five two-digit random numbers. Store the integers in an array. Verify all

Write a program to help students practice median. Write a program to generate five two-digit random numbers. Store the integers in an array. Verify all numbers are unique, no duplications.

Display the numbers and ask the student to find the median of the generated numbers. Note that the median is the middle number of a sorted list. You can use the following statement to sort the array:

java.util.Arrays.sort(myArray);

Here are sample test cases:

What is the median of these numbers: 53, 20, 15, 45 and 90: 20

Your answer is not correct.Do you want to try again? (Y/N): Y

What is the median of these numbers: 53, 20, 15, 45 and 90: 90

Your answer is not correct.Do you want to see the answer? (Y/N): N

What is the median of these numbers: 53, 20, 15, 45 and 90: 20

Your answer is not correct.Do you want to see the answer? (Y/N): Y

The correct answer is 45.Do you want to play again? (Y/N): Y

What is the median of these numbers: 63, 22, 15, 35 and 83: 35

Your answer is correct.Do you want to play again? (Y/N): N

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!