program banking (input,output);
procedure initialize(var firstAccount : real);
begin
firstAccount := -1;
end;
function hasNoAccounts (firstAccount : real):
boolean;
begin
(* Check if the account has been opened or not *)
if (firstAccount >= 0) then
hasNoAccounts := false
else
hasNoaccounts :=
true;
end;
procedure showBalance(firstAccount : real);
begin
(* Check if the account has been opened and if so then display it's
balance *)
if (firstAccount >= 0) then
writeln('First account $', firstAccount:0:2)
else
writeln('No accounts opened.');
end;
procedure makeDeposit (var firstAccount: real);
begin
(* Check if the account has been opened and if so then write the
code to make a deposit *)
end;
procedure makeWithdrawal(var firstAccount :
real);
begin
(* Check if the account has been opened and if so then write the
code to make a withdrawal *)
end;
procedure openAccount (var firstAccount :
real);
begin
(* Write the code to open account if it has not already been opened
*)
end;
(* Of course you will have to change the parameter list for the procedure and function calls for this version *)
begin
var menuSelection : char;
var quitProgram : boolean;
var firstAccount : real;
quitprogram := false;
initialize(firstAccount);
repeat
begin
displayMenu;
menuSelection := getMenuSelection;
writeln;
case (menuSelection) of
'D', 'd':
makeDeposit(firstAccount);
'S', 's':
showBalance(firstAccount);
'W', 'w':
makeWithdrawal(firstAccount);
'T', 't':
makeTransfer;
'O', 'o':
openAccount(firstAccount);
'Q', 'q':
quitProgram := true;
else
writeln('Please enter one of:
''d'', ''s'', ''t'', ''w'', ''o'' or ''q''');
end;
end;
until (quitProgram = true);
writeln('Thank you for banking with TAMCO Banking (TM)');
end.