Question: JAVA Write a BankAccount class and a custom Exception class to handle deposits and withdraws operations. The BankAccount class should have three main methods, withdraw,
JAVA



Write a BankAccount class and a custom Exception class to handle deposits and withdraws operations. The BankAccount class should have three main methods, withdraw, deposit and Monthly_Dividend. While the custom Exception class "NotEnoughBalance "should contain an amount and a message to tell what the reason was for the Exception. The following list shows each class details NotEnoughBalance Class: This class inherits from Exception class. Attributes double Amount o Amount that caused this exception Methods: Implement the following 4 constructors and call the corresponding super class: NotEnoughBalance 0 NotEnoughBalance (double amount, Throwable cause) NotEnoughBalance (double amount, String message) NotEnoughBalance (double amount, String message,_Throwablee cause) BankAccount Class Attributes: double Balance o Holds the balance in this account double Yearly_Dividend Yearly returned Dividend Methods: Void deposit(double amount); o A method that will accept an amount to deposit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
