Write a program withC++ to simulate a casino slot machine. The slot machine will acceptbets for the following amounts: $1, $5, $10, $20, $50, $100 and$1,000.The program will operate by having the slot machine select arandom number (the winning number) at the start of the day and/orafter the slot machine pays out a winner. Each time the playerpulls the slot handle, he/she will generate a random number. If theplayer’s number is the same as the winning number, the player willwin all or a percentage of the jackpot as illustrated in the payofftable
BCATPayoff Table |
|
BetAmount |
Payoff (Greater of the twoamounts) |
$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 determinethe 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 – Theamount of money won by the player. Bet Amount – The amount of moneywagered by the player
Jackpot – The total money in thejackpot eligible to be won by the player
Winning Number – The random number thatrepresents the number needed to win
Player’s Number – Therandom number that is compared to the winning number to determineif the player wins.
Pulling the Slot Handle – the act ofgetting a new random number that 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:…