# (Solved) : Overview Assignment Write Program Simulate Game Roulette Roulette Casino Game Chance Playe Q41352220 . . .

language is C++. please help
Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance where a player may choose to place bets on either a single number, the colors red or black, or whether a number is even or odd. (Note: bets may also be placed on a range of numbers, but we will not cover that situation in this program.) A winning number and color is determined by a croupier/dealer spinning a wheel in one direction and a ball in the opposite direction. The wheel contains 38 colored and numbered pockets. The pocket that the ball falls into is the winning number and color. The pockets of the roulette wheel are numbered with 00 and 0 through 36. The 0 and 00 pockets are green. In the ranges through 10 and 19 through 28, the odd numbers are red and the even numbers are black. In the ranges 11 through 18 and 29 through 36, the odd numbers are black and the even numbers are red. For this assignment, and 00 will be treated the same. Basic Program Logic The program will use the random number generator to simulate the spinning of the wheel. Therefore, the random number generator must be seeded. This is done one time in the program. Use srand(6) for the final version of the program that will be graded Call the betOptions Menu function that is described below to display a menu of possible options to the player and get their bet option. In a loop that will execute as long as the player does not want to quit the game of roulette: • Call the spinWheel function that is described below to get the pocket where the ball lands when the croupier/dealer spins the wheel. • If the player chose to bet on a single number, call the getSingleNum function that is described below to get the number that the player wants to bet on. Call the display WheelResult function that is described below to display the number of the pocket where the ball landed. If the player’s number matches the number of the pocket where the ball landed, display a congratulatory message to the player. If the player’s number does not match the number of the pocket where the ball landed, display a message that the player lost. • If the player chose to bet on the colors red or black, call the getPocketColor function that is described below to determine the color of the pocket where the ball landed when the wheel was spun. Call the display WheelResult function to display the color that the wheel landed on (green, red, or black) along with the number for the pocket. If the player’s color matches the color of the pocket on the wheel, display a congratulatory message to the player. If the player’s color does not match the color of the pocket where the ball landed, display a message that the player lost. Note: landing on either of the green pockets is a loss. • If the player chose to bet even or odd, call the getPocketEvenOdd function that is described below to determine the category of pocket where the ball landed when the wheel was spun Call the display WheelResult function to display the category (even, odd, or zero) and the number of the pocket where the ball landed. If the player’s choice matches the category of the pocket on the wheel, display a congratulatory message to the player. If the player’s choice does not match the category of the pocket where the ball landed, display a message that the player lost. Note: landing on either of the Os is a loss • Call the betOptions Menu function to get the user’s next bet option The Functions Write and use the following 6 functions in the program int spin Wheel This function will generate a random number between 0 and 36 to simulate the spinning of the roulette wheel. It takes ne argument. It returns an integer: the random sumber between 0 and DO NOT call the sand function in this function. This is being done in mind. char betOptions Menu This function will display a menu of the possible betting options and get a VALID choice from the player. It takes no arguments. It returns a character: the player’s betting choice The function should display the menu of possible options (S for a single number bet, R for a bet on red, B for a beton Black, E for a bet on even, O for a beton odd, or to quit the game) and then get the player’s betting choice. The player’s betting choice should be validated and the player should be made to re-enter a value until they have made a valid selection The lowercase representation of each menu option should be considered a valid option Once the player has entered a valid option, it should be returned to the calling function. int getSingleNum) This function will get a number between 0 and 36 from the player. It takes to arguments. It returns an integer the player’s number The function should prompt the user to enter a number between 0 and 36. The player’s number should be validated and the player should be made to re-enter a value until they have made a valid selection Once the player has selected a valid number, it should be returned to the calling function char getPocketColor(int pocketNum ) This function will determine the color of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character an uppercase letter that represents the color of the pocket where the ball landed The function should test the value of the pocket Num argument and return for green for red, or for black. As described above, the pockets of the roulette wheel are numbered with 00 and through 36. The 0 and 00 pockets are GREEN. In the ranges through 10 and 19 through 28, the odd numbers are RED and the even numbers are BLACK. In the ranges 11 through 18 and 29 through 36, the odd numbers are BLACK and the even numbers are RED. char get PocketEvenOdd( int pocketNum ) This function will determine the category (even, odd, or zero) of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character: an uppercase letter that represents the category of the pocket where the ball landed. The function should test the value of the pocketNum argument and return ‘E’ for an even number, for an odd number, or for zero. char get PocketEvenOdd( int pocketNum ) This function will determine the category (even, odd, or zero) of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character an uppercase letter that represents the category of the pocket where the ball landed. The function should test the value of the pocketNum argument and return ‘Efor an even number for an odd number, or for zero. void display WheelResult(char type, int pocketNum ) This function will display the result of croupier dealer spinning the wheel. It takes two arguments a character that represents the type of bet and an integer that represents the number of the pocket where the ball landed. It returns nothing The function should test the value of the type argument and display one of three things. If the type argument represents a single number bet (S), display the number of the pocket where the ball landed. If the type argument represents that the bet was on a color (R’ B’or ). display the color of the pocket and the number of the pocket where the ball landed. If the type argument represents that the bet was on a category (EO orZ), display the category of the pocket and the number of the pocket where the ball landed. Processing Requirements 1. As with the previous assignments and the assignments until the end of the semester complete program documentation is required. For this assignment, that means that line documentation AND function documentation boxes are needed. In regards to line documentation, there is no need to document every single line, but logical chunks of code should be preceded by a line or two that describe what the “chunk” of code does. Make sure that main) and any function that you write contains line documentation Each function must have a documentation box detailing: o its name its use or function that is, what does it do? What service does it provide to the code that calls it? • a list of its arguments briefly describing the meaning and use of each the value returned (if any) or none notes on any unusual features, assumptions, techniques, etc. Functione void displayWheel Result( char type, int poeket ) Use: This function displays the result of spinning the roulette Wheel Arguments type – a character that represents the type of bet made by the player pocket Numan integer that represents the number of the pocket where the ball landed when the wheel was spun Returns Nothing Noter None See the documentation standards on the course webpage for more examples or if further clarification is needed. Your program will not get full credit (even if it works correctly) if these standards are not followed 2. Make sure to use meaningful variable names. 3. Be sure to include <cstdlib 4. Make sure that the copy of the program that is handed in uses stand(6), to set the seed value for the random number generator 5. Hand in a copy of the source code (CPP file) using Blackboard. Output Run using srand(6); on Windows PC What type of bet would you like? (5 – Single number, R – red, B- black, E-even, O-odd, what number would you like to bet on (0-36)? 3 The wheel is spinning…and landed on 21 You LOSTI – quit the game). S odd, – quit the game) What type of bet would you like? 5 – Single number, red, 3 – black, E-even, O The wheel is spinning…and landed on BLACK (13) You LOSTI What type of bet would you like? (S=single number, R red, black, even, O The wheel is spinning…and landed on RED (1) You LOSTI dd, quit the game) odd, quit the game) What type of bet would you like? (5 – Single number, R – red – black, E-even, The wheel is spinning…and landed on BLACK (20) You WON: – quit the game) What type of bet would you like? (8 – Single number, R – red, B – black, E – even, 0 – odd, The wheel is spinning… and landed on EVEN (26) You WONI What type of bet would you like? (8 – Single number, R – red, B – black, E-even, O-odd, The wheel is spinning… and landed on EVEN (36) – quit the game): You LOST! quit the game) What type of bet would you like? (S = single number, R = red, B- black, E-even, O. odd, The wheel is spinning…and landed on EVEN (30) You LOST: quit the game) What type of bet would you like? (8 – Single number, R red, B- black, E – even, o – odd, The wheel is spinning…and landed on ODD (33) You MONI – quit the game) What type of bet would you like? (s – Single number, R- red, B-black, E-even, O-odd, Invalid Option. Try again. H Invalid Option. Try again. G Invalid Option. Try again: s What number would you like to bet on (0-36)? -9 Invalid Number. Try again: 57 Invalid Number. Try again. 42 Invalid Number. Try again: -42 Invalid Number. Try again: 18 The wheel is spinning…and landed on 5 You LOSTI What type of bet would you like? 15 – Single number, R – red, 3 – black, E – even, o – odd, – quit the game): Show transcribed image text Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance where a player may choose to place bets on either a single number, the colors red or black, or whether a number is even or odd. (Note: bets may also be placed on a range of numbers, but we will not cover that situation in this program.) A winning number and color is determined by a croupier/dealer spinning a wheel in one direction and a ball in the opposite direction. The wheel contains 38 colored and numbered pockets. The pocket that the ball falls into is the winning number and color. The pockets of the roulette wheel are numbered with 00 and 0 through 36. The 0 and 00 pockets are green. In the ranges through 10 and 19 through 28, the odd numbers are red and the even numbers are black. In the ranges 11 through 18 and 29 through 36, the odd numbers are black and the even numbers are red. For this assignment, and 00 will be treated the same. Basic Program Logic The program will use the random number generator to simulate the spinning of the wheel. Therefore, the random number generator must be seeded. This is done one time in the program. Use srand(6) for the final version of the program that will be graded Call the betOptions Menu function that is described below to display a menu of possible options to the player and get their bet option. In a loop that will execute as long as the player does not want to quit the game of roulette: • Call the spinWheel function that is described below to get the pocket where the ball lands when the croupier/dealer spins the wheel. • If the player chose to bet on a single number, call the getSingleNum function that is described below to get the number that the player wants to bet on. Call the display WheelResult function that is described below to display the number of the pocket where the ball landed. If the player’s number matches the number of the pocket where the ball landed, display a congratulatory message to the player. If the player’s number does not match the number of the pocket where the ball landed, display a message that the player lost. • If the player chose to bet on the colors red or black, call the getPocketColor function that is described below to determine the color of the pocket where the ball landed when the wheel was spun. Call the display WheelResult function to display the color that the wheel landed on (green, red, or black) along with the number for the pocket. If the player’s color matches the color of the pocket on the wheel, display a congratulatory message to the player. If the player’s color does not match the color of the pocket where the ball landed, display a message that the player lost. Note: landing on either of the green pockets is a loss.
• If the player chose to bet even or odd, call the getPocketEvenOdd function that is described below to determine the category of pocket where the ball landed when the wheel was spun Call the display WheelResult function to display the category (even, odd, or zero) and the number of the pocket where the ball landed. If the player’s choice matches the category of the pocket on the wheel, display a congratulatory message to the player. If the player’s choice does not match the category of the pocket where the ball landed, display a message that the player lost. Note: landing on either of the Os is a loss • Call the betOptions Menu function to get the user’s next bet option The Functions Write and use the following 6 functions in the program int spin Wheel This function will generate a random number between 0 and 36 to simulate the spinning of the roulette wheel. It takes ne argument. It returns an integer: the random sumber between 0 and DO NOT call the sand function in this function. This is being done in mind. char betOptions Menu This function will display a menu of the possible betting options and get a VALID choice from the player. It takes no arguments. It returns a character: the player’s betting choice The function should display the menu of possible options (S for a single number bet, R for a bet on red, B for a beton Black, E for a bet on even, O for a beton odd, or to quit the game) and then get the player’s betting choice. The player’s betting choice should be validated and the player should be made to re-enter a value until they have made a valid selection The lowercase representation of each menu option should be considered a valid option Once the player has entered a valid option, it should be returned to the calling function. int getSingleNum) This function will get a number between 0 and 36 from the player. It takes to arguments. It returns an integer the player’s number The function should prompt the user to enter a number between 0 and 36. The player’s number should be validated and the player should be made to re-enter a value until they have made a valid selection Once the player has selected a valid number, it should be returned to the calling function char getPocketColor(int pocketNum ) This function will determine the color of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character an uppercase letter that represents the color of the pocket where the ball landed The function should test the value of the pocket Num argument and return for green for red, or for black. As described above, the pockets of the roulette wheel are numbered with 00 and through 36. The 0 and 00 pockets are GREEN. In the ranges through 10 and 19 through 28, the odd numbers are RED and the even numbers are BLACK. In the ranges 11 through 18 and 29 through 36, the odd numbers are BLACK and the even numbers are RED. char get PocketEvenOdd( int pocketNum ) This function will determine the category (even, odd, or zero) of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character: an uppercase letter that represents the category of the pocket where the ball landed. The function should test the value of the pocketNum argument and return ‘E’ for an even number, for an odd number, or for zero.
char get PocketEvenOdd( int pocketNum ) This function will determine the category (even, odd, or zero) of the pocket where the ball landed after the wheel was spun. It takes an integer argument: the number of the pocket where the ball landed. It returns a character an uppercase letter that represents the category of the pocket where the ball landed. The function should test the value of the pocketNum argument and return ‘Efor an even number for an odd number, or for zero. void display WheelResult(char type, int pocketNum ) This function will display the result of croupier dealer spinning the wheel. It takes two arguments a character that represents the type of bet and an integer that represents the number of the pocket where the ball landed. It returns nothing The function should test the value of the type argument and display one of three things. If the type argument represents a single number bet (S), display the number of the pocket where the ball landed. If the type argument represents that the bet was on a color (R’ B’or ). display the color of the pocket and the number of the pocket where the ball landed. If the type argument represents that the bet was on a category (EO orZ), display the category of the pocket and the number of the pocket where the ball landed. Processing Requirements 1. As with the previous assignments and the assignments until the end of the semester complete program documentation is required. For this assignment, that means that line documentation AND function documentation boxes are needed. In regards to line documentation, there is no need to document every single line, but logical chunks of code should be preceded by a line or two that describe what the “chunk” of code does. Make sure that main) and any function that you write contains line documentation Each function must have a documentation box detailing: o its name its use or function that is, what does it do? What service does it provide to the code that calls it? • a list of its arguments briefly describing the meaning and use of each the value returned (if any) or none notes on any unusual features, assumptions, techniques, etc. Functione void displayWheel Result( char type, int poeket ) Use: This function displays the result of spinning the roulette Wheel Arguments type – a character that represents the type of bet made by the player pocket Numan integer that represents the number of the pocket where the ball landed when the wheel was spun Returns Nothing Noter None See the documentation standards on the course webpage for more examples or if further clarification is needed. Your program will not get full credit (even if it works correctly) if these standards are not followed 2. Make sure to use meaningful variable names. 3. Be sure to include

## Expert Answer

Answer to Overview For this assignment, write a program that will simulate a game of Roulette. Roulette is a casino game of chance…