Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions