Question
Write a program in C to simulate a casino slot machine. The slot machine will accept bets for the following amounts: $1, $5, $10, $20,
Write a program in C to simulate a casino slot machine. The slot machine will accept bets for the following amounts: $1, $5, $10, $20, $50, $100 and $1,000.The program will operate by having the slot machine select a random number (the winning number) at the start 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 a random number. If the player’s number is the same as the winning number, the player will win all or a percentage of the jackpot as illustrated 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 amount wagered by the player after each turn (For example, if the jackpot is $20,000 and the players bets $100, the new jackpot will be $20,100.
The slot will hit (meaning the player wins) 1% of the time.
There are three random number generators: the winning number for the slot machine, the player’s number and one to determine the wager.
The amount of money wagered during each play is randomly selected. The amount of money wagered must be one of the following: $1, $5, $10, $20, $50, $100, and $1000. Use an array store the 7 different bet amounts.
The simulation will operate for 24 hours straight with the slot machine being played once a minute. This means the slot machine will be played 1,440 times in 24 hours. Use a loop to simulate a player pulling the slot handle.
Additional Criteria:
The program will terminate after the simulated 24 hours is complete and all output is written to a text file. The required output is stated below.
Every time the slot handle is pulled, the following information is 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 following information 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 is outputted:
The amount of money the casino will make/lose because of the slot machine.
The amount of money made by the slot machine equals the amount of money entered by the player over the 24 hour period – amount of money paid out by the slot
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Program code screen shot include include include main function int main 1 seeding a random number sr...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