Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you are to write a program to simulate playing the lottery game PowerBall. The rules for PowerBall can be found by clicking

For this assignment you are to write a program to simulate playing the lottery game PowerBall. The rules for PowerBall can be found by clicking on this link: http://www.mnlottery.com/games/lotto_games/powerball/ or by clicking on this link: http://www.powerball.com/powerball/pb_howtoplay.asp

Prizes and Odds of Winning Match Win Approx.

Odds 5 of 5 + Powerball JACKPOT* 1 in 292,201,338

5 of 5 numbers $1,000,000 1 in 11,688,054

4 of 5 + Powerball $50,000 1 in 913,129

4 of 5 numbers $100 1 in 36,525

3 of 5 + Powerball $100 1 in 14,494

3 of 5 numbers $7 1 in 580

2 of 5 + Powerball $7 1 in 701

1 of 5 + Powerball $4 1 in 92

Powerball ONLY $4 1 in 38

What you must do:

1. You are to ask the user to input their numbers for the PowerBall 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 powerball is the red ball.

2. Your program will simulate the PowerBall 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 3 4 5 for the first five numbers (the white balls), the user can also select as their PowerBall number 5 or 4 or 3 or 2 or 1. Uniqueness of the numbers only pertains to the white balls that are randomly generated and those values that are input from the user.

4. Determine the amount of money the user has won based upon the rules shown above.

5. Demonstrate your program works by including test data where the user has won each prize.

6. Do not implement the power play option for the game. ? Functions must be used to solve this problem. The number of functions should be significant since you have multiple tasks to perform. I.e. A program solution with only two functions would not be acceptable. Main will not be considered as one of the functions of the programming solution. You will be graded on program optimization, i.e. redundant code based upon testing scenarios will be penalized. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago