Question: You are to write a program in Java to simulate a lottery. The Player will select five numbers from 1 to 6 9 . The
You are to write a program in Java to simulate a lottery. The Player will select five numbers from to The computer will generate random numbers from to
Jackpot defined for this assignment:
The grand prize jackpot starts at million. The player will win this amount if all of the players numbers match all five of the computer numbers. Each time the grand prize jackpot is not won in a game, the jackpot will increase by million. If any numbers are matched the player will be assigned a winning of $ for each matched number.
The player will then be asked if they want to play again. Your code will run until the user wants to stop.
The specifications of the project are as follows:
You must have a user defined class within the code. Code done in only one main method will not be accepted
You will have the following methods:
Method to generate the computer numbers and prompt the player to enter their numbers
Method to check for matches and assign winnings
Method to print results of current game one set of numbers from the player and the computer
Method to print all of the final results after the player is done playing
You must use an array of integers for the players numbers and another array of integers for the computer generated lottery numbers. If your code does not have the data defined this way, the code will not be accepted.
How the program will work:
Create code to randomly generate lottery numbers. You will have to check that the computer generates unique numbers from to
Create code to prompt the player to enter numbers. You will have to check that the player enters unique numbers from to But you do not have to check for any other data input errors.
You will then check for a match of the players numbers and the lottery numbers. You will keep track of how many numbers matched and any money won.
You will print out the results of the play numbers matched and any money won in that single game
If the jackpot was not won, you will add million to the jackpot. If the jackpot was won, you will start the jackpot over at million again
You will ask the player if they want to play again. You must keep track of a running total of what was won and how many times the player played the lottery game
Finally, after the player has quit playing, you are to print:
The number of times the player played the lottery
The number of times a number was matched
The total amount of money won
The final value of the jackpot
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
