[Solved]Method Generate Produce Integer Arrays Random Size 10 20 Members Method Print Print Member Q37105967
-
The method generate() will produce integer arrays of arandom size between 10 and 20 members.
-
The method print() will print out the members of aninteger array input.
-
The method insert() will accept two arrays as inputs. Itwill produce a new array long enough to contain both arrays, andboth input arrays should be inserted into the new array in thefollowing manner: select a random member of the first array, andinsert every member of the second array in before the first array.Thus, output should look like this (with smallerarrays):
Input 1: {1,2,3,4,5,6} Input 2:{10,11,12,13}
Output: {1,2,3,10,11,12,13,4,5,6}
-
The method shorten() should accept an input array and aninput integer. It should check if the input integer actually refersto an index within the range of the input array’s length. If not,then return the original array. Otherwise, return a new arrayhaving length that is one member less than the input. The outputarray in that case should have the member referenced by the inputindex removed. E.g:
Input1: {1,2,3,4,5,6,7} Input 2: 25
Output: {1,2,3,4,5,6,7}
Input1: {1,2,3,4,5,6,7} Input 2: 5
Output: {1,2,3,4,5,7}
Write a main method that asks the user if they want torun insert or shorten. In each case, use generate() to producerandom array inputs for each one, and generate your own randominteger inputs. Then run the method associated with the userinput.
Expert Answer
Answer to The method generate() will produce integer arrays of a random size between 10 and 20 members. The method print() will p… . . .
OR

