Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C, write a simulated dice game of Chuck-a-luck. Chuck-a-luck requires three six-sided dice. The goal of the game is to bet money. The game

Using C, write a simulated dice game of Chuck-a-luck. Chuck-a-luck requires three six-sided dice. The goal of the game is to bet money. The game ends when the player is out of money or chooses to cash out.

image text in transcribedimage text in transcribed

image text in transcribed

The player selects an amount of money to bet and then selects one of the 6 types of bets: O Numbers Bet If that number is rolled, the player is paid 1 to 1 on singles, 2 to 1 on pairs, and 10 to 1 on triples appearing on the dice Field Bet If the total of the 3 dice are one of the numbers in the field area (5, 6, 7, 8, 13, 14, 15, 16), the player is paid 1 to 1. Odd Bet If the total on the 3 dice is odd, the player is paid 1 to 1, but loses if a triple is rolled. Even Bet If the total on the 3 dice is even, the player is paid 1 to 1, but loses if a triple is rolled. High Bet If the total of the 3 dice are over 10, the player is paid 1 to 1, but loses if a triple is rolled. Low Bet If the total of the 3 dice are under 11, the player is paid 1 to 1, but loses if a triple is rolled. . o O O Sample Output: Let's play CHUCK-A-LUCK! Enter money to bank: $100 +----- How much would you like to bet? $10 What bet would you like to place (N-numbers, F-field, 0-odd, E-even, H-high, L-low): N Select the number (1-6): 5 **3** +*5** +*2** YOU WIN $10!! You have $110 in your bank. Do you want to play again (Y/N)? Y How much would you like to bet? $20 What bet would you like to place (N-numbers, F-field, 0-odd, E-ever, H-high, L-low): E **1** **6** You lose $20. You have $90 in your bank. Do you want to play again (Y/N)? Y How much would you like to bet? $50 What bet would you like to place (N-numbers, F-field, O-odd, E-even, H-high, L-low): H **3** **2** +*6** YOU WIN $50!! You have $140 in your bank. Do you want to play again (Y/N)? **INVALID input. Please try again. Do you want to play again (Y/N) ? Y How much would you like to bet? $50 What bet would you like to place (N-numbers, F-field, 0-odd, E-even, H-high, L-low): R **INVALID input. Please try again. What bet would you like to place (N-numbers, F-field, 0-odd, E-even, H-high, L-low): N Select the number (1-6): B **INVALID input. Please try again. Select the number (1-6): 5 +*5** **5** +*2 YOU WIN $100!! You have $240 in your bank. Do you want to play again (Y/N)? n You cashed out $240. Game Over. Program design: Use top-down design to break the game into at least 4 functions/ tasks. You must use at least 3 functions (excluding main(): 1. void function 2. value-returning function 3. a function that uses a pointer as a parameter this is just an example of a structure chart to demonstrate possible tasks. Your program should be designed differently. main rollDice calcWinner NOTES: Include error checking of user inputs. Do not allow the player to place a bet for more money than they have in the bank. The game should automatically end when the player is out of money. You lose $20. You have $0 in your bank. Game Over

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago