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
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