Question: In java code please Goals Understand exceptions Description A bank provides a checking account that enables the client to deposit and withdraw funds. The account

In java code please

Goals

Understand exceptions

Description

A bank provides a checking account that enables the client to deposit and withdraw funds. The account is protected from overdraft in case of insufficient funds the transaction is cancelled. An account can also be locked by the bank which disables all transactions on the account until it is unlocked again. A printout of account's balance is provided after every operation.

Create a BankAccount class that has two major methods: deposit and withdraw. Both methods can throw an AccountLockedException if the account is locked. The withdraw method can also throw InsufficientFundsException. Create both these exception classes.

Write a program that creates a bank account object and runs all possible transaction scenarios (hard coded) such as:

  • deposit into the account
  • withdraw from the account
  • locking the account
  • trying to deposit funds into locked account
  • unlocking the account
  • trying to withdraw an amount than exceeds the account balance

Exception handlers are required for all possible exceptions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To complete this Java program youll need to define a BankAccount class two custom exception classes AccountLockedException and InsufficientFundsException and a main class to demonstrate various transa... View full answer

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!