Question: Advanced Java - Bank program: (accs=accounts) Execute the objct model shown to execute a small banking app. Create 5 classes: Bank, BankAcc, SavingsAcc, CheckingAcc, &

Advanced Java - Bank program:

Advanced Java - Bank program: (accs=accounts) Execute the objct model shown to

(accs=accounts)

Execute the objct model shown to execute a small banking app. Create 5 classes: Bank, BankAcc, SavingsAcc, CheckingAcc, & Customer Bank. They should be a singleton class. To make it uncomplicated, the bank stores bank accs in 1 array & customers in another. All bank accs are savings or checking accs, & any customer may have 0 or 1 acc of each type.

The difference btwn the 2 accs affects only the withdraw method. The withdraw method decrements the balance, but cant always do so. The deposit method just increments the balance. A customer can withdraw from a SavingsAcc only an amnt the current balance. For a CheckingAcc the logic is-

Withdraw the amnt if the balance

If the customer has a SavingsAcc, & the SavingsAcc has enough $ to cover the shortfall in the CheckingAcc, transfer enough $ from saving to checking to cover the withdrawal. Then withdraw the $.

If the customer has no savings acc, or the total of both accs is InsufficientFundsException exception - simply print msg if Exception hasnt been covered).

Add a main method to the Bank class to test. Create 1 customer & give that customer a savings acc. Try a deposit & withdrawal. Give the customer a checking acc & try another deposit. Try withdrawals that succeed w/o a transfer, that transfer funds from savings, & for which there are insufficient funds

Bank BankAccount accountList customerList accountNo owner balance has O..n addCustomer addAccount deposit abstract withdraw has SavingsAccount CheckingAccount withdraw withdraw O..n Customer id savingsAcct checkingAcct addSavingsAccount addCheckingAccount 0..1 0..1 has has

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!