Menu Option one:
This function should create a 1-D array of size 60 containing randomly generated letters within the range [a, z]. Determine a) the maximum and minimum values and b) the indices of their first occurrence and c) the number of times each occurs. Write the values, number of occurrences, and indices to the output file (midterm1.txt) in a user-specified rectangular format – that is, the user will supply a valid number of rows.
NOTES: You will need to perform the following operations
Initialize the array - fill the array with random letters in the appropriate range between a and z
Determine the max, the array index of its first occurrence and the number of times it occurs
Determine the min, the array index of its first occurrence and the number of times it occurs
Prompt the user for a valid number of rows N such that 60/N is an integer
Write the contents of the array to the file (midterm1.txt) with N letters per line. (eg. 4 x 15, 10 x 6, etc.)
Menu Option two:
Continually prompt the user for a phrase (sentence) and then for a letter (to be used as a terminating character) until the user enters the phrase “stop”. Search each phrase for the first occurrence of the terminating character in the phrase and modify the phrase so it ends with the character preceding the user’s chosen terminating character. Write the modified phrase out to the screen. In the event that the letter does not appear in the phrase write an appropriate informational message.
Example: (italics indicate user entered information and non-italics indicate your program’s output)
The cow jumped over the moon
u
The cow j
Hello there
X
The letter X does not appear in the entered phrase
stop
You have chosen to stop, goodbye