Question: in java please Create an array of (pseudo) random ints and present a menu to the user to choose what array manipulations to do. Specifically,

in java please

Create an array of (pseudo) random ints and present a menu to the user to choose what array manipulations to do. Specifically, the program should:

Declare constants to specify the maximum integer that the array can contain (set to 8) and the integer whose occurrences will be counted (set to 3, to be used in one of the menu options).

Ask the user to enter a seed for the generation of random numbers (this is so you get the same results even though it is random).

Ask the user what the size of the array should be. Read in the size; it should be greater than 1. Keep making the user re-enter the value as long as it is out of bounds.

Create a new random number generator using the seed.

Create the array and fill it in with random numbers from your random number generator. ( random numbers therefore array elements should be in the range 0 to and random numbers should match).

Show the user a menu of options (see examples that are given). Implement each option. The output should be in the exact same format as the example. Finally, the menu should repeat until the user chooses the exit option.

examples

in java please Create an array of (pseudo) random ints and present

Please enter a seed: 1 Please enter the size of the array: 1 Array size must be greater than 1. Please reenter: Array size must be greater than 1. -1 Please reenter: Please reenter: Array size must be greater than 1. 12 Please choose an option: 1 Print the array 2. Find the average 3 Find the largest element 4 Count how many times 3 occurred 5 Count how many elements are less than half of the first element 6 Find how many times numbers repeat consecutively 7 Swap the first and last elements Exit 1 nmin 0 Array: 6 1 1 6 8 4 5 1 1 1 7 7 Please choose an option: 1 Print the array 2 Find the average 3 Find the largest element 4 Count how many times 3 occurred 5 Count how many elements are less than half of the first element 6 Find how many times numbers repeat consecutively Swap the first and last elements 8 Exit 2 Average: 4.0 Please choose an option: 1 Print the array 2 Find the average 3 Find the largest element 4 Count how many times 3 occurred 5 Count how many elements are less than half of the first element 6 Find how many times numbers repeat consecutively 7 Swap the first and last elements Exit 3

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!