Hullo! Please write the code for the following program using JAVA! Be sure to re
ID: 666003 • Letter: H
Question
Hullo! Please write the code for the following program using JAVA!
Be sure to read CAREFULLY before proceeding!!!
When done PLEASE compile and run to make sure the code WORKS!!!
CHEEERS!!!
Implement the object model shown in Figure 1-25 (attached) to implement a small banking application. Create five classes: Bank, BankAccount, SavingsAccount, CheckingAccount, and Customer. Bank Should be a singleton class. For simplicity, the bank stores bank accounts in one array and customers in another. All bank accounts are savings accounts or checking accounts, and any customer may have zero or one account of each type.
The difference between the two accounts affects only the withdraw method. The deposit method simply increments the balance. The withdraw method decrements the balance, but cannot always do so. A customer can withdraw from a SavingsAccount only an amount less than or equal to the current balance. For a CheckingAccount the logic is:
Withdraw the amount if less than or equal to the balance.
If the customer has a SavingsAccount, and the SavingsAccount has enough money to cover the shortfall in the CheckingAccount, transfer enough money from saving to checking to cover the withdrawal. Then withdraw the money.
If the customer has no savings account, or the total of both accounts is less than the withdrawal amount, issue an InsufficientFundsException exception(just print message if Exception has not been covered).
Add a main method to the Bank class to test. Create one customer and give that customer a savings account. Try a deposit and withdrawal. Give the customer a checking account and try another deposit. Try withdrawals that succeed without a transfer, that transfer founds from savings, and for which there are insufficient funds.
Explanation / Answer
Account.java
Bank.java
CheckingAccount.java
InsufficientFundsException.java
savingsAccount.java
Customer.java
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.