with Types; use Types;
package Database is
------------------------------------------------------------------------
--| Maintains bank's internal data about open accounts and balances
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: January 1996
------------------------------------------------------------------------
protected Manager is
-- All these procedures are protected, so only one call at a time
-- will be executed, even if the calls arrive concurrently.
procedure EnterCustID (ID : out CustID; Stat : out Status);
-- Pre: None
-- Post: ID is the next available customer ID; Stat is OK.
procedure Deposit (ID : in CustID; Amount : in Money;
NewBalance : out Money; Stat : out Status);
-- Pre: ID and Amount are defined
-- Post: If ID is valid, NewBalance is the resulting balance
-- and Stat is OK; otherwise, Stat is BadCustID.
procedure Withdraw (ID : in CustID; Amount : in Money;
NewBalance : out Money; Stat : out Status);
-- Pre: ID and Amount are defined
-- Post: If ID is valid and NewBalance would be nonnegative,
-- Stat is OK and NewBalance is returned.
-- If ID is invalid, Stat is BadCustID; if NewBalance
-- would be negative, Stat is InsufficientFunds
procedure Balance (ID : in CustID; Amount : out Money;
Stat : out Status);
-- Pre: ID is defined
-- Post: If ID is invalid, Stat is BadCustID; otherwise,
-- Stat is OK and Amount is current balance
end Manager;
end Database;