Professional Documents
Culture Documents
Calculator Write-Up Pseudo Code-Prgmmmfinal
Calculator Write-Up Pseudo Code-Prgmmmfinal
Pseudo codeprgmMMFINAL:
prgmMMBEGIN
prgmMMTITLE
prgmMMBEGIN:
ClrHome
For(X,1,16)
Output(4,X,"Maura's Games
For(Y,1,150)
End
ClrHome
End
prgmMMTITLE:
Menu("Let's play Craps!","with directions",M,"no directions",N,"quit",O)
Lbl M
prgmMMCRAPS
Stop
Lbl N
prgmMMCRAP2
Lbl O
ClrHome
prgmMMCRAPS:
ClrHome
Disp "If you bet 24"
Disp "cents you can"
Disp "win $3!"
Disp "enter to cont."
Pause
ClrHome
Disp "You just have"
Disp "to win on your"
Disp "first roll!"
Disp "enter to cont."
Pause
ClrHome
Disp "If you win on"
Disp "your second roll"
Disp "you win $2!"
Disp "enter to cont."
Pause
ClrHome
Disp "Or if you"
Disp "win on your"
Disp "third roll you"
Disp "can win $1!"
Disp "enter to play!"
Pause
ClrHome
Disp "Lets Play Craps!"
Disp "enter to cont."
Pause
ClrHome
Disp "In Craps you"
Disp "roll 2 dice."
Disp "enter to cont."
Pause
ClrHome
Disp "Your goal is to"
Disp "have your dice"
Disp "add to 71"
Disp "enter to cont."
Pause
ClrHome
prgmMMCRAP2
prgmMMCRAP2:
ClrHome
Disp "Start Rolling!"
Disp "enter to cont."
Pause
ClrHome
Disp "You rolled a:"
randInt(1,6)A
Disp A
Disp "enter to cont."
Pause
Disp "And a:"
randInt(1,6)B
Disp B
Disp "enter to cont."
Pause
Disp "Your total is:"
A+BC
Disp C
If 11=C or 7=C
Then
Disp "You win $3!"
Disp "enter to cont."
Pause
prgmMMPLAYCR
Else
If 11C7
Then
Disp "enter to cont."
Pause
prgmMMCRAPDI
End
prgmMMPLAYCR:
Menu("Play Again?","yes",P,"no",Q)
Lbl P
prgmMMTITLE
Stop
Lbl Q
ClrHome
prgmMMCRAPDI:
ClrHome
Disp "Let's try again!"
Disp "You rolled a:"
randInt(1,6)A
Disp A
Disp "enter to cont."
Pause
Disp "And a:"
randInt(1,6)B
Disp B
Disp "enter to cont."
Pause
Disp "Your total is:"
A+BC
Disp C
If 11=C or 7=C
Then
Disp "You win $2!"
Disp "enter to cont."
Pause
prgmMMPLAYCR
Else
If 11C7
Then
Disp "enter to cont."
Pause
prgmMMCRAP3
prgmMMCRAP3:
ClrHome
Disp "Let's try again!"
Disp "enter to cont."
Pause
Disp "You rolled a:"
randInt(1,6)A
Disp A
Disp "enter to cont."
Pause
Disp "And a:"
randInt(1,6)B
Disp B
Disp "enter to cont."
Pause
Disp "Your total is:"
A+BC
Disp C
If 11=C or 7=C
Then
Disp "You win $1!"
Disp "enter to cont."
Pause
prgmMMPLAYCR
Else
If 11C7
Then
Disp "You lose:("
Disp "enter to cont."
Pause
prgmMMPLAYCR
End
Flow Chart:
Probability math:
outcomes
value
number of ways
price
$3
$24
$2
224
$448
$1
6272
$6272
lose
$0
21952
$0
Fair price:
$24+$448+$6272=$6744
8+224+6272+21952=28456
$6744/28456=$0.24
From there you just have to hit enter whenever enter to cont. shows on the screen.
When you are done playing another menu with show up asking if you would like to play again or
not.