Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can Someone Please help me with this C program??? Write a program in C to simula

ID: 3691883 • Letter: C

Question

Can Someone Please help me with this C program???

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. Hint. 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.

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 by the player

Winning Number – The random number that represents the number needed to win

Player’s Number – The random number that is compared to the winning number to determine if the player wins.

Pulling the Slot Handle – the act of getting a new random number that becomes the player’s number

Acceptance Criteria:

Documented C code that compiles and executes without errors.

C file and output file submitted to Blackboard without zipping files.

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

Extra Credit:

Modify your program to simulate a casino operating 10 slot machines

Acceptance Criteria:

Write one output file per slot machine to illustrate its operations based on the original acceptance criteria

Write a totals output file to show how much the casino made from each slot machine and the total amount made by the casino from all of the slot machines.

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

Explanation / Answer

Here im writing the code for casino machine in c++...may be this will help you out

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

#include<stdio.h>

#include<time>

void draw_line(int n,char ch);

void rules();

void main()

{

int balanceamt,amt,no,dice;

char playername[80],ch;

clrscr();

draw_line(60,'=');

cout<<" enter your name:";

gets(playername);

cout<<" enter deposit amount to play game:";

cin>>balanceamt;

do {

clrscr();

rules();

cout<<" your current balance is Rs."<<balanceamt;

do

{

cout<<" "<<playername<<"enter money to bet";

cin>>amt;

if(amt>balanceamt)

cout<<"your betting amount is more than your current balance reenter data ";

else

break;

}

while(1);

do

cout<<"enter your lucky number to bet between 1 to 12 : ";

cin>>no;

if(no <=0|| no>12)

cout<<"please check the number !! should be between 1 to 12 re enter data ";

else

break;

}

while(1);

randomize();

dice=random(12)+1;

if(dice==no)

{

cout<<" good luck !! you won Rs."<<amt*10;

balanceamt=balanceamt+amt*10;

}

else

{

cout<<"bad luck this time!! you lose Rs."<<amt;

balanceamt=balanceamt-amt;

}

cout<<" the winning number was :"<<dice;

cout<<" "<<playername<<"you have Rs."<<balanceamt<<endl;

cout<<" -->do you want to play (y/n)?";

cin>>ch;

while(ch=='Y' || ch=='y')

clrscr();

cout<<" ";

draw_line(70,'+');

cout<<" Thanks for come to casino your balance amount is Rs."<<balanceamt<<" ";

draw_line(70,'+');

getch();

}

void draw_line(int n,char ch)

{

for(int i=0;i<n:i++)

cout<<ch;

}

void rules()

{

clrscr();

cout<<" ";

draw_line(60,'-');

cout<<" rules of the game ";

draw_line(60,'-');

cout<<" 1.choose any number between 1 to 12 .if you win you will get 10 times of money you bet 3.if you bet on wrong number you will lose your betting amount ";

draw_line(60,'-');

cout<<endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote