QB64 Phoenix Edition
Lemonade Stand 2 - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: SierraKen (https://qb64phoenix.com/forum/forumdisplay.php?fid=62)
+---- Thread: Lemonade Stand 2 (/showthread.php?tid=2938)



Lemonade Stand 2 - SierraKen - 08-14-2024

I got this idea from a very old computer text game from the 1980's. I'm sure mine is a bit simpler, but it's unique. Smile

Code: (Select All)

_Title "Lemonade Stand 2"
Screen _NewImage(800, 600, 32)
begin:
Cls
Print: Print: Print
Print "                                        Lemonade Stand 2"
Print: Print
Print "                                        by  SierraKen"
Print: Print
Print "You start with $20."
Print "There are 5 cups per pitcher."
Print "There are 30 cups per package of cups."
Print "There will be weather, donations, and advertising."
Print "Cup packages and pitchers can only be used for one day."
Print: Print
Input "                                    Press Enter to begin.", a$
Cls
money = 20
ads = 0
day = 0
Randomize Timer
Do
    day = day + 1
    Locate 1, 1: Print "Day: "; day
    weather = Int(Rnd * 8) + 1
    If weather = 1 Then w$ = "Hot"
    If weather = 2 Then w$ = "Sunny"
    If weather = 3 Then w$ = "Cloudy"
    If weather = 4 Then w$ = "Windy"
    If weather = 5 Then w$ = "Rainy"
    If weather = 6 Then w$ = "Cold"
    If weather = 7 Then w$ = "Snowy"
    If weather = 8 Then w$ = "Hail"
    Locate 2, 1: Print "Weather: "; w$
    pitcher = Int(5 / weather) + 2
    Locate 4, 1: Print "Cost Of One Pitcher Of Lemonade Today: $"; pitcher
    cups = Int(Rnd * 7) + 2
    Locate 5, 1: Print "Cost Of One Package Of Cups Today: $"; cups
    Locate 6, 1: Input "Price Of Each Glass $", price
    sales1 = Int((Int(Rnd * 92) + 8) / weather)
    donations = Int(Rnd * 4) + 1
    If donations = 2 Then
        donatedmoney = Int(Rnd * 20) + 1
        money = money + donatedmoney
    End If
    Locate 7, 1: Input "Amount to spend on advertising: $", ads
    sales2 = (Int(Rnd * sales1) / price) + sales1
    sales3 = Int(Rnd * (ads * 2)) + 3
    sales4 = Int(sales2 + sales3)
    sales5 = sales4 * price
    Locate 9, 1: Print "Cups Of Lemonade Sold: "; sales4; " glasses today."
    pitchersused = Int(sales4 / 5) + 1
    Locate 10, 1: Print "Pitchers Used"; pitchersused
    pitchersold = pitchersused * pitcher
    cupsold = Int(sales4 / 30) + 1
    cupsdeduct = cupsold * cups
    Locate 11, 1: Print "Cup Packages Used:"; cupsold
    Locate 12, 1: Print "You have made $"; sales5 - pitchersold - cupsdeduct - ads
    money = money + sales5 - ads
    money = money - pitchersold
    money = money - cupsdeduct
    Locate 13, 1: Print "Donations: "; donatedmoney
    Locate 14, 1: Print "Total Income: $"; money
    If money = 0 Or money < 0 Then GoTo done:
    Locate 16, 1: Print "Do you want to sell tomorrow (Y/N)?"
    yesno:
    yn$ = InKey$
    If yn$ = "Y" Or yn$ = "y" Then GoTo more:
    If yn$ = "N" Or yn$ = "n" Then GoTo done:
    GoTo yesno:
    more:
    Cls
Loop
done:
Cls
Print "Your Total Days: "; day
Print "Your Total Money: "; money
Print: Print
Print "Do you want to play again (Y/N)"
again:
again$ = InKey$
If again$ = "y" Or again$ = "Y" Then GoTo begin:
If again$ = "n" Or again$ = "N" Then End
GoTo again: