Enter the amount on deposit 100
Enter the withdrawal 50
Accepted. Balance is 50
Enter the amount on deposit 76
Enter the withdrawal 120
Refused! Balance is 76
NAME | TYPE | Notes |
---|---|---|
balance | INTEGER | balance in the account |
withdrawal | INTEGER | amount requested by user |
1. get balance & withdrawal 1.1 get balance 1.2 get withdrawal 2. if withdrawal amount less than balance then 2.1 indicate transaction accepted else 2.2 indicate transaction rejected
-- Fintan Culwin Sept '88 v1.0 -- program to illustrate simple selection -- b1s4p1 see text p43-44 with TEXT_IO; use TEXT_IO; procedure b1s4p1 is package int_io is new TEXT_IO.INTEGER_IO( INTEGER ); use int_io; balance, -- balance in the account withdrawl : integer; -- withdrawl from the account begin -- of b1s4p1 -- get balance & withdrawal PUT ( "Enter balance of the account "); GET ( balance ); SKIP_LINE; PUT ( "Enter the withdrawal "); GET ( withdrawl ); SKIP_LINE; -- decide upon action if balance >= withdrawl then PUT ( "Accepted. balance is "); PUT ( balance - withdrawl ); NEW_LINE; else PUT ( "Refused! balance is "); PUT ( balance ); NEW_LINE; end if; end b1s4p1;