Write a program with C++ to simulate a casino slot machine. Theslot machine will accept bets for the following amounts: $1, $5,$10, $20, $50, $100 and $1,000.The program will operate by havingthe slot machine select a random number (the winning number) at thestart of the day and/or after the slot machine pays out a winner.Each time the player pulls the slot handle, he/she will generate arandom number. If the player’s number is the same as the winningnumber, the player will win all or a percentage of the jackpot asillustrated in the payoff table
BCAT Payoff Table |
|
Bet Amount |
Payoff (Greater of the two amounts) |
$1 |
.01% of jackpot or $100 |
$5 |
.05% of jackpot or $500 |
$10 |
1% of jackpot or $1000 |
$20 |
2% of jackpot or $2000 |
$50 |
5% of jackpot or $5000 |
$100 |
10% of jackpot or $10,000 |
$1000 |
Total jackpot or $100,000 |
Assumptions:
- The jackpot starts the day with $10,000 and grows by the amountwagered by the player after each turn (For example, if the jackpotis $20,000 and the players bets $100, the new jackpot will be$20,100.
- The slot will hit (meaning the player wins) 1% of thetime.
- There are three random number generators: the winning numberfor the slot machine, the
player’s number and one to determine the wager.
- The amount of money wagered during each play is randomlyselected. The amount of money wagered must be one of the following:$1, $5, $10, $20, $50, $100, and $1000. Hint. Use an arraystore the 7 different bet amounts.
- The simulation will operate for 24 hours straight with the slotmachine being played once a minute. This means the slot machinewill be played 1,440 times in 24 hours. Use a loop to simulate aplayer pulling the slot handle.
Definitions:
Amount Won – The amount of money won by the player. Bet Amount –The amount of money wagered by the player
Jackpot – The total money in the jackpot eligible to be won bythe player
Winning Number – The random number that represents the numberneeded to win
Player’s Number – The random number that is compared to thewinning number to determine if the player wins.
Pulling the Slot Handle – the act of getting a new random numberthat becomes the player’s number
Acceptance Criteria:
- Documented C code that compiles and executes withouterrors.
- C file and output file submitted to Blackboard without zippingfiles.
- The program will terminate after the simulated 24 hours iscomplete and all output is written to a text file. The requiredoutput is stated below.
- Every time the slot handle is pulled, the following informationis outputted (to a file):
- Amount of the jackpot
- Amount of the current bet
- The winning number
- The players number
- In addition to the information listed above, the followinginformation should be displayed when a player wins:
- The amount of money won by the player
- At the end of the 24 hours, the following information isoutputted:
- The amount of money the casino will make/lose because of theslot machine.
- The amount of money made by the slot machine equals the amountof money entered by the player over the 24 hour period – amount ofmoney paid out by the slot
Expert Answer
Answer to Write a program with C++ to simulate a casino slot machine. The slot machine will accept bets for the following amounts:…