Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ One question has Page 1 and 2 Roulette Simulation in which In this programming assignment you will be creating a limited simulation of roulette.
C++
Roulette Simulation in which In this programming assignment you will be creating a limited simulation of roulette. Roulette is a game participants place wagers regarding the outcome of a ball landing in one of 38 numbered bins (0-36, plus an additional slot labelled 00) on a spinning wheel. You will simulate wagering, the ball landing on the spinning wheel, and the outcome of the wager, that is, whether the participant wins or loses the wager. Starting the game: The better should start out playing with 1000 chips. Print out the possible wagers that users can make. For each possible wager, also list the payout for a winning wager. The table of possible wagers and payouts is below. Duplicate this table output in your own program. l Input | Wager | Payout I 1 1 | Even numbers 2, 4, 6, ..., 36) 1 to 1 I 1 2 Odd numbers 1, 3, 5, 35) I 1 to 1 I 1 3 | 1st half 1, 2, 3, ., 18) 1 to 1 I I 4 2nd half (19, 20, 21, .. ., 36) | 1 to 1 | S Exact guess 36, 0, and 00 135 to 1 l Input: The user should be prompted for their type of wager (I1] Even, 21 Odd, 13] 1st half, I4] 2nd half, or [51 Exact). Implement this as a menu and incorporate into the printed table listed above. If the user wagers on an exact number, they should also be asked for the number on which they would like to wager. Finally, the user should be asked for an amount of chips to wager. However, they must wager a positive amount and may not wager more chips than they currently possess. If any of the player's inputs are invalid, notify them of the mistake they made and allow them to re-input until they enter a valid input. Once validated, the entered information should be reflected back to the user and the user should be given a choice to take back their wager or proceed with the game. For example, suppose that the user wagered 100 chips on even. Then a prompt like this should appear: You have decided to wager 100 chips on even. Is this correct? Enter 'Y' to proceed with the game OR enter 'N' to take back your wager: If the user entersY' or 'y,, then the "spin" proceeds. If the user enters N, or any other input, then they forfeit their wager and they will not proceed with that roulette spin (they will have to wait until the next spin). Simulating the spin: To simulate the ball landing in one of the 38 bins on given a spin (create an int called winningNum), you will employ C++ functions and other code that randomly selects an integer value between - and 36. To do so, use the random number technique described in class and printed in the lecture notes. Note that One question has Page 1 and 2
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