Write ainsufficientfundsexceptionclass - the class should


1. Write a InsufficientFundsException class.
a. This class should extend Exception, since it is going to be a checked exception.
b. The constructor should take the amount of the shortfall (as a double) and store it in a member variable.
c. We want to see some sort of message like "Not enough money!" in the stack trace, so call a Exceptionconstructor that takes a message by using the superkeyword at the beginning of your classes constructor and pass it an appropriate message string.
d. The class should have a getShortfallmethod to access the amount given in the constructor. This method should return a double.

2. Write a BankAccount class.
a. The constructor should take aintfor the account ID number. Bank accounts should initially have a balance of zero.
b. Provide a getAccountIDmethod to return the intaccount number.
c. Provide a getBalancemethod to return the current account balance. This value should be a double.
d. The class should have a depositmethod that takes a doubleamount and adds it to the current account balance. This method returns nothing.
e. The class should have a withdrawmethod that takes a double amount and sub- tracts it from the current account balance. This method returns nothing. If the amount attempted to withdraw is greater than the current account balance, this method will throw an InsufficientFundsException.

Attachment:- BankingTest.rar

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write ainsufficientfundsexceptionclass - the class should
Reference No:- TGS02386301

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)