Question: Background: In this program, our goal is see the differences between Java and C when it comes to arrays. Prompt FILENAME: MathGame.java I love to
Background:
In this program, our goal is see the differences between Java and C when it comes to arrays.
Prompt
FILENAME: MathGame.java
I love to solve puzzles. Some of my favorite puzzles are the ones you can redo multiple times. Sometimes you just need to shuffle them them up and you will have a unique experience.
I would like you to create a program that does the following:
Ask the user how many numbers they would like to generate. User will put in an integer valued from I will call this variable n
Create n random values and store them in an integer array. These random numbers should be between and
Create a menu that will ask the user if they would like to play game, shuffle, generate new numbers, sort or exit.
If they select play game, display each value in the array and ask the user to add all the values up If they enter the correct number, print out a success message. If it is incorrect print out a message saying they were wrong and what the correct number is
If they select shuffle, print the current state of the array and ask the user how many times they would like to shuffle. For each shuffle, randomly select two values and switch their values in the array. Print out the final state of the array.
If they select generate new numbers, reassign all values in the current array. Do not create a new array. Ranges should be
If they select sort array, sort the array ascending
If they select exit, end the loop. Do not use the quit method.
Create a method that takes in an integer array and prints out the list in a formatted way.
Sample Run:
Welcome to random number generator!
How many values would you like to use:
Created!
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
Add these values:
That was incorrect. The value adds to be:
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
Add these values:
That is correct!
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
Current:
How many swaps?
Final:
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
Current:
Final:
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
New Values:
Select your option:
Play Game
Swap Values
New Values
Sort
Exit
Goodbye
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
