The Bank
This is your
typical bank that has customers with accounts -- customers can deposit and
withdraw money from these accounts.
Here are the requirements:
1) In your file that has main
defined, you'll need to open two file streams for reading (the new
customers and the daily transactions) and a file
stream for writing (your grade output). Naturally, we will edit these
file names when we grade your program. You'll need to pass handles
to these input/output file streams to functions/classes as
necessary. We need you to:
2) Here's the format of a transaction
in the new customers input file with expected response:
3) Here's the transactions that
must be handled from the daily transactions input file.
Two things to note: 1) These are things that both a customer and
the bank would do on an ongoing basis; 2) The format of all the
transactions below is : string string integer real. If
any of the fields are not necessary for that particular kind of transaction, it
will have a 0 (zero) placeholder.
§
§
Invalid account number
accountNumber
·
· close 0 accountNumber 0
§
§
Invalid account number
accountNumber
·
· total savings 0 0
total checking 0 0
total overdraft 0 0
o
o This is the bank computing the dollars in all
savings/checking/overdraft accounts
o
o Print a message to the outfile and to the screen
giving the total dollars in all accounts
·
· average savings 0 0
average checking 0 0
average overdraft 0 0
o
o This is the bank computing the average dollars per
customer in savings/checking/overdraft accounts
o
o Print a message to the outfile and to the screen
giving the total dollars in all accounts
quit 0 0
![]()

1 Flow of Events for the CustomerTransaction
Use Case
1.1 Preconditions
None.
1.2 Main Flow
This use case begins when a new or established customer performs a transaction at The Bank. If the transaction is:
1.3 Subflows
S-1 Verify Account Number
Execute the Verify Account Number subflow of the Account Repository use case. Return a message indicating whether the specified account number is among the set of bank customers.
S-2
Open New Account
If there are no current accounts with the new account number (E-1), add new customer account (E-2, E-3)
S-3
Deposit to Savings
If the account number is valid (E-4), add amount to the customer’s savings balance (E-8).
S-4
Deposit to Checking
If the account number is valid (E-4), add amount to the customer’s checking balance (E-8)..
.
S-5
Withdraw from Savings
If the account number is valid (E-4), execute the Report savings balance subflow of the Account use case. Ensure the amount the customer is attempting to withdraw is less than or equal to the savings balance(E-5). Subtract amount from balance.
S-6
Withdraw from Checking
If the account number is valid (E-4), execute the Report checking balance subflow of the Account use case. Ensure the amount the customer is attempting to withdraw is less than or equal to the checking balance(E-5). Subtract amount from balance.
S-7
Process Check
If the account number is valid (E-4), execute the Report checking balance subflow of the Account use case. Ensure the amount of the check is less or equal to than the checking balance(E-6). Subtract amount from balance.
S-8 Pay
Overdraft
If the account number is valid (E-4), execute the Report overdraft balance subflow of the Account use case. Ensure the overdraft payment is for an amount less than or equal to the overdraft balance (E-7). Subtract the amount from balance.
S-9
Savings Balance
If the account number is valid (E-4), execute the Report savings balance subflow of the Account use case.
S-10
Checking Balance
If the account number is valid (E-4), execute the Report checking
balance subflow of the Account use case.
S-11
Overdraft Balance
If the account number is valid (E-4), execute the Report overdraft balance subflow of the Account use case.
1.4 Alternative Flows
E-1: The account number is already among the set of customer account. Invalid.
E-2: The new customer is trying to open an account with less than a $5 deposit to checking
E-3: The new customer is trying to open an account with less than a $1 deposit to savings
E-4: The account number is not among the set of customer accounts. Invalid.
E-5: The customer is trying to withdraw more than they have in account.
E-6: The check is for an amount greater than amount in checking account. Increment overdraft account for the difference + $15.
E-7: The overdraft payment is for an amount greater than the overdraft balance. Increment.
E-8: The amount to deposit is negative
2 Flow of Events for the Bank
Transactions Use Case
2.1 Preconditions
The Initialize subflow of the Account Repository use case has been executed.
2.2 Main Flow
This use case begins when The Bank performs a transaction. If the transaction is:
2.3 Subflows
S-1 Verify Account Number
Execute the Verify Account Number subflow of the Account Repository use case. Return a message indicating whether the specified account number is among the set of bank customers.
S-2
Close Account
Remove the customer account from the set of customer accounts.
S-3
Total Savings
Execute the Report Savings Balance of the Account Repository use case to obtain the balance in all savings accounts.
S-4
Total Checking
Execute the Report Checking Balance of the Account Repository use case to obtain the balance in all checking accounts.
S-5
Total Overdraft
Execute the Report Overdraft Balance of the Account Repository use case to obtain the balance in all overdraft accounts.
S-6
Average Savings
Execute the Report Savings Balance of the Account Repository use case to obtain the balance in all savings accounts. Execute the Report Number of Customers subflow of the Account Repository use case to obtain the number of bank customers. Divide the balance in all savings ccounts by the number of customers (E-1) to obtain the average savings balance.
S-7
Average Checking
Execute the Report Checking Balance of the Account Repository use case to obtain the balance in all checking accounts. Execute the Report Number of Customers subflow of the Account Repository use case to obtain the number of bank customers. Divide the balance in all checking accounts by the number of customers (E-1) to obtain the average checking balance.
S-8
Average Overdraft
Execute the Report Overdraft Balance of the Account Repository use case to obtain the balance in all overdraft accounts. Execute the Report Number of Customers subflow of the Account Repository use case to obtain the number of bank customers. Divide the balance in all overdraft accounts by the number of customers (E-1) to obtain the average overdraft balance.
2.4 Alternative Flows
E-1 There
are no customers in the bank. Protect
from division by zero
3 Flow of Events for the Account
Repository Use Case
3.1 Preconditions
none
3.2 Main Flow
The Account Repository is initialized (S-6). This use case traverses the set of customer accounts to verify account numbers (S-1) and report savings balances (S-2), checking balances (S-3), overdraft balances (S-4), and the number of customer accounts (S-5)
3.3 Subflows
S-1 Verify Account Number
Query each bank account via the Report account number subflow of the Account use case. Send a message indicating whether the specified account number has been found among the set of customer accounts.
S-2
Report Total Savings Balance
For each bank account, execute the Report Savings Balance subflow of the Account use case. Accumulate the sum of all savings balances. Return a message with the total in all savings accounts.
S-3
Report Total Checking Balance
For each bank account, execute the Report Checking Balance subflow of the Account use case. Accumulate the sum of all checking balances. Return a message with the total in all checking accounts.
S-4
Report Total Overdraft Balance
For each bank account, execute the Report Overdraft Balance subflow of the Account use case. Accumulate the sum of all overdraft balances. Return a message with the total in all overdraft accounts.
S-5
Report Number of Customers
Send a message indicating the number of bank customers.
S-6
Initialize
An empty set of bank customers is initialized.
3.4 Alternative Flows
4 Flow of Events for the Account
Use Case
4.1 Preconditions
none
4.2 Main Flow
The account maintains its account number and balance status. The account number, savings, checking and overdraft balances can be reported (S-1, S-2, S-3, S-4). The savings, checking, and overdraft balances can be updated (S-5, S-6, S-7).
4.3 Subflows
S-1 Report account number
Send a message indicating the account number.
S-2
Report savings balance
Send a message indicating the savings account balance.
S-3
Report checking balance
Send a message indicating the checking account balance.
S-4
Report overdraft balance
Send a message indicating the overdraft account balance.
S-5
Update savings balance
Change the value of the savings account balance.
S-6
Update checking balance
Change the value of the savings account balance.
S-7
Update overdraft balance
Change the value of the savings account balance.
4.4 Alternative Flows