Question
For this homework you will develop four classes called Bank, Account, Customer, and Transaction to store account information, customer information, and transaction information of a
For this homework you will develop four classes called Bank, Account, Customer, and Transaction to store account information, customer information, and transaction information of a bank. Based on the sample input data and sample run, you should identify operations of the project.
For the homework, you can use either Array or ArrayList. If you use arrays, you can assume that your Bank class can have maximum 30 Accounts, 30 Customers, and 100 Transactions. Note that an Account object can have only one Customer, and each Customer can have maximum two accounts (= one checking and one savings accounts). A Transaction object should include the account number, transaction type (= deposit, withdrawal, and closing an account), and transaction date/time information.
Sample Input File
The following file represents a sample bank data file, c:\\tmp\\test1.txt, which is used in the sample runs below. Note that the first line (= 4) indicates the number of customers in the bank. The customers information includes the name, address, zip code, and SSN. Note that each customer data is delimited by comma symbol (,).
After the customer data, there is a number of accounts (= 5 in the example). Each account information has SSN, account number, account type (1: checking, 2: savings), and current balance. Again, comma is used as a delimiter.
4
Tom Smith,123 University Center,93955,777-77-7777
Alice Smith,123 University Center,93955,888-88-8888
Joe Otter,2440 Ocean Avenue,93900,999-99-9999
Monica Smith,123 University Center,93955,123-45-7777
5
777-77-7777,1000,1,10.0
888-88-8888,2000,1,50.25
777-77-7777,3000,2,100.0
999-99-9999,5000,1,100.25
888-88-8888,6000,2,500.25
Sample Demo Program
The following presents a sample demo program called BankDemo1.java.
public class BankDemo1 { public static void main(String[] args) { Bank csumbBank = new Bank("My Bank"); System.out.println("========== READ DATA =========="); csumbBank.readData("C:\\tmp\\test1.txt"); System.out.println("========== DONE =========="); System.out.println(" ========== BANK INFORMATION =========="); csumbBank.bankInfo(); System.out.println(" ========== ACCOUNT INFORMATION =========="); csumbBank.accountInfo(1000); csumbBank.deposit(1000, 150.25); System.out.println(" ========== ACCOUNT INFORMATION =========="); csumbBank.accountInfo(1000); csumbBank.withdraw(1000, 100); System.out.println(" ========== ACCOUNT INFORMATION =========="); csumbBank.accountInfo(1000); System.out.println(" ========== ACCOUNT CLOSE =========="); if (csumbBank.closeAccount(1000)) { System.out.println("Account closed."); } System.out.println(" ========== TRANSACTION INFO =========="); csumbBank.transaction(1000); System.out.println(" ========== TRANSACTION INFO =========="); csumbBank.transaction(2000); } }
The following presents a sample execution result. At the sample run, we assume that the deposit of the account number 1000 happened in Sep. 28, 2015. The exact time is 15:23:25 (= HH:MM:SS format). When you run the demo program, your program should get the date and time of the deposit() method execution time. Similarly, we assume that the withdraw() and closeAccount() methods were invoked at 2015-09-28, 15:23:26 and 15:23:28, respectively.
========== READ DATA ==========
========== DONE ==========
========== BANK INFORMATION ==========
Bank Name: My Bank
Number of Customers: 4
Tom Smith: 777-77-7777
Alice Smith: 888-88-8888
Joe Otter: 999-99-9999
Monica Smith: 123-45-7777
Number of Accounts: 5
1000: $10.00
2000: $50.25
3000: $100.00
5000: $100.25
6000: $500.25
Total Balance: $760.75
========== ACCOUNT INFORMATION ==========
- Number: 1000
- Checking
- Balance: $10.00
- Customer: Tom Smith
========== ACCOUNT INFORMATION ==========
- Number: 1000
- Checking
- Balance: $160.25
- Customer: Tom Smith
========== ACCOUNT INFORMATION ==========
- Number: 1000
- Checking
- Balance: $60.25
- Customer: Tom Smith
========== ACCOUNT CLOSE ==========
Account closed.
========== TRANSACTION INFO ==========
- Account Number: 1000, Deposit ($150.25), 2015-09-28, 15:23:25
- Account Number: 1000, Withdraw ($100.00), 2015-09-28, 15:23:26
- Account Number: 1000, Account closed, 2015-09-28, 15:23:28
========== TRANSACTION INFO ==========
- No transaction for account 2000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started