
-----------------------------------
princess
Wed Jun 18, 2003 9:26 pm

My bank machine
-----------------------------------
ok another one of my ugly programs this one took me forever........ i don't even understand why.... its soo freaking simple...


var balance : real %globel variable
var font1, font2 : int
balance := 1000 %assigning variable a value
font1 := Font.New ("Lucida Console:48:Bold")
font2 := Font.New ("Lucida Console:14")



procedure Deposit %start of procedure
    colourback (gray)
    cls
    drawfillbox (50, 50, 750, 550, black)
    var deposit : real %declaring all variables
    Font.Draw ("DEPOSITS", 300, 400, font1, brightgreen)
    %Title of the procedure
    colourback (black)
    colour (white)
    locate (25, 37)
    put "Enter amount of deposit: $" .. %Asking for user input
    get deposit %user input
    balance := balance + deposit %adding deposit to the balance
    put "Current balance: $", balance : 0 : 2 %outputing the new balance
    delay (3000)
end Deposit %end of procedure



procedure Withdrawal %start of the procedure
    colourback (gray)
    cls
    drawfillbox (50, 50, 750, 550, black)
    var withdrawal : real %decalre all variables
    Font.Draw ("WITHDRAWALS", 300, 400, font1, brightgreen)
    %Title of the procedure
    colourback (black)
    colour (white)
    locate (25, 37)
    put "Enter amount of withdrawal: $" .. %asking for user input
    get withdrawal %user input
    if withdrawal  6 then
            locate (33, 34)
            put "Invaild Option"
            delay (2000)
            cls
        else
            locate (33, 34)
            put "Cancelled"
            exit when opt = 6
        end if
    end loop
    put "Current Balance: ", balance : 0 : 2
    delay (3000)
end FastCash



procedure Balance
    put "Your Current Balance: $", balance
    delay (3000)
end Balance

procedure Main
    loop
        colourback (gray)
        cls
        drawfillbox (50, 50, 750, 550, black)
        var s : int
        Font.Draw ("MAIN MENU", 300, 400, font1, brightgreen)
        Font.Draw ("How may I help you?", 350, 350, font2, white)

        Font.Draw ("1. Deposit", 375, 325, font2, white)
        Font.Draw ("2. Withdrawal", 375, 300, font2, white)
        Font.Draw ("3. Fast Cash", 375, 275, font2, white)
        Font.Draw ("4. Balance", 375, 250, font2, white)
        Font.Draw ("5. Exit", 375, 225, font2, white)
        colourback (black)
        locate (35, 48)
        colour (white)
        put "Option #: " ..
        get s
        delay (2000)
        cls
        if s = 1 then
            Deposit
        elsif s = 2 then
            Withdrawal
        elsif s = 3 then
            FastCash
        elsif s = 4 then
            Balance
        elsif s = 5 then
            put ""
            put ""
            put "Thank You & Good-Bye"
            exit when s = 5
        else
            put ""
            put "Invaild Option"
        end if
    end loop
end Main



setscreen ("graphics:800;600")
Main


-----------------------------------
Droobie
Tue Jan 18, 2005 11:12 am


-----------------------------------
hmm update this..try to make it more interactive like putting in a pin number and such add come simple graphics  :shock:

-----------------------------------
Drakain Zeil
Tue Jan 18, 2005 4:05 pm


-----------------------------------
I didn't look into really, but it seems to me that the center of your program can be changed to a few lines with a for end for loop, where all those IFs are.

-----------------------------------
AsianSensation
Tue Jan 18, 2005 8:44 pm


-----------------------------------
notice the original post date...2003!!!
