Question: In a loop, the user will be presented with a random number between 1 and 100. They can choose to keep the number, discard the
In a loop, the user will be presented with a random number between 1 and 100. They can choose to keep the number, discard the number or quit so the last number is not considered. The user has two lists, the keep list and the discard list. Each list is kept in the order they were added. When the user quits the loop, each list is displayed(or indicates empty) as well as the total and average for each list. Use arrays and not ArrayList. Allocate 20 for the size of each array and do not the user overfill the array. Generate no more than 25 total numbers(meaning that the loop to generate numbers will terminate after the 25th or if the user hits quit). Output should look like this: New number: 20 Enter option: (K, D, Q) : K is to keep the number, D to discard and Q to quit the program. Once the program finishes the discard and keep lists should be displayed with all the numbers that were kept or discarded and the total kept and discarded and their averages. Thanks a lot!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
