Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment you are to write a program to simulate playing the lottery game PgwerBall. The rules for PowerBall can be found by clicking
For this assignment you are to write a program to simulate playing the lottery game PgwerBall. The rules for PowerBall can be found by clicking on this link: http://www.mnlotterv.com/games/lotto games/powerball or by clicking on this link: http://www.powerball.com Upb howtopla Prizes and Odds of Winning Win JACKPOT1 in 292,201,338 $1,000,000 1 in 11,688,054 Approx. Odds Match 5 of 5Powerball 5 of 5 numbers 4 of 5 Powerball $50,000 4 of 5 numbers 3 of 5Powerbal $100 3 of 5 numbers 2 of 5Powerball $7 1 of 5Powerball 4 Powerball ONLY 1 in 913,129 1 in 36,525 1 in 14,494 1 in 580 1 in 701 1 in 92 1 in 38 $100 $7 S4 What vou must do: 1. You are to ask the user to input their numbers for the RgweBall drawings. Your program needs to perform input validation for each number entered by guaranteeing the number has not already been chosen and that it is a valid number for the lottery game PowerBall. The first five numbers must be between 1 and 69 inclusive and the powerball must be between 1 and 26 inclusive. The first five numbers are the white balls and the powerbal1 is the red ball 2. Your program will simulate the PawerBall drawing by using a random number generator to randomly select the 5 white balls and the one red ball for the lottery game. The program must guarantee each number generated for any of the five white balls has not already been selected. If the number has already been selected your program should generate a new number. You do not need to do this with the PowerBall number since only one number is selected. 3. NOTE: The PowerBall selection can be one of the numbers selected for the five white balls. For example Suppose the user enters 1 2 345 for the first five numbers (the white balls), the user can also select as their PowerBall number 5 or 4 or 3 or 2 or1. Uniqueness of the numbers only pertains to the white balls that are randomly generated and those values that are input from the user e amount of money the user has won based upon the rules shown above. Determine th Demonstrate your program works by including test data where the user has won each prize. Do not implement the power play option for the game 4. 5. 6. Functions must be used to solve this problem. The number of functions should be significant since you have multiple tasks to perform. L.e. A program solution with only two functions would not be acceptable. Using a brute- force approach to determine if the user is a winner will also be penalized. i.e. too many if or case statements where you can develop mathematical relationships to determine the amount won
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started