Please fined the attachment.
Program 4
In this assignment you will use the Java array class to help you. First, create an array of N random
integers in the range of 1 to 100 (you can use the Java random class for this). Get the value of N from
the user. Next ask the user to input a number in this range (1 to 100) and then search the array to
locate all occurrences of the search number. For each occurrence, print out the number and the
position at which it was found.
Then sort the array and search again, displaying all occurrences of the search number. If the search
number is not found, then display a message to that effect.
Finally, print the sum of all of the numbers in the array.
Example:
How many randon numbers between 1 and 160: 1900
Which random number are you searching for?: 5
Unsorted List
5 found at location: 502
5 found at location: 225
5 found at location : 856
5 found at location: 924
Sorted List
5 found at location : 40
5 found at location : 41
5 found at location: 42
5 found at location: 43
Total of all numbers: 49089