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 <= balance then
%start of the outer if statement-only condition
if withdrawal rem 10 = 0 then
%start of the innter if statement-first condition
balance := balance - withdrawal
%takes amount of money out of the withdrawal
else %for the error message
locate (26, 37)
put "Invaild amount(most be a multiple of 10)"
end if
else %if the balance is less than withdrawal
locate (26, 37)
put "Insufficient Funds"
end if %end of the if statements
put "Current balance: $", balance : 0 : 2
%displays balance after withdrawal
delay (3000)
end Withdrawal %end of procedure
procedure FastCash
var opt : int
loop
colourback (gray)
cls
drawfillbox (50, 50, 750, 550, black)
Font.Draw ("FAST CASH", 300, 400, font1, brightgreen)
%Title of the procedure
colourback (black)
colour (white)
locate (25, 37)
put "Choose an option"
locate (27, 37)
put "1.) $10"
locate (28, 37)
put "2.) $20"
locate (29, 37)
put "3.) $40"
locate (30, 37)
put "4.) $80"
locate (31, 37)
put "5.) $100"
locate (32, 37)
put "6.) Cancel"
locate (34, 37)
put "Your choice: " ..
get opt
if opt = 1 then
if balance < 10 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 10
exit when opt = 1
end if
elsif opt = 2 then
if balance < 20 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 20
exit when opt = 2
end if
elsif opt = 3 then
if balance < 40 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 40
exit when opt = 3
end if
elsif opt = 4 then
if balance < 80 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 80
exit when opt = 4
end if
elsif opt = 5 then
if balance < 100 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 100
exit when opt = 5
end if
elsif opt > 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
|