Question
Create a program RandomArray with an array containing 100 random integers from 1-100. Use a for loop to generate and store random numbers in the
Create a program RandomArray with an array containing 100 random integers from 1-100.
Use a for loop to generate and store random numbers in the array. Use the SecureRandom class to generate the random numbers.
Sort the array. Use the bubble sort method below to sort the array in ascending order (low to high).
Display the sorted array in right-aligned columns with ten numbers to a line.
Determine how many duplicates there are and display each duplicated number and the count. Create a duplicates array to hold the count of each random number. Hint: array size should be 101. The array index should represent the number.
Determine all numbers from 1-100 that are missing from the array of random numbers and display them in right-aligned columns five numbers to a line.
Use the command prompt window (terminal) for your program.
Do NOT create any other methods or use any built-in Java methods.
Be sure to label all output.
It should look like:
Sorted Array 1 2 2 3 7 9 9 9 9 10 12 12 12 14 15 15 17 17 18 20 23 24 24 25 25 26 28 29 30 32 32 32 33 33 34 34 37 37 39 40 41 42 43 45 45 45 47 47 47 47 48 48 48 49 49 50 51 52 52 52 53 53 54 56 56 57 57 58 61 62 62 63 65 65 66 66 67 67 67 68 68 70 70 74 79 80 80 82 83 86 88 89 90 91 92 93 96 99 100 100 Duplicate Count 2 2 9 4 12 3 15 2 17 2 24 2 25 2 32 3 33 2 34 2 37 2 45 3 47 4 48 3 49 2 52 3 53 2 56 2 57 2 62 2 65 2 66 2 67 3 68 2 70 2 80 2 100 2 Missing Numbers 4 5 6 8 11 13 16 19 21 22 27 31 35 36 38 44 46 55 59 60 64 69 71 72 73 75 76 77 78 81 84 85 87 94 95 97 98
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