Question: Modify the BankAccount class to throw an IllegalArgumentException when the account is constructed with a negative balance, when a negative amount is deposited, or when
Modify the BankAccount class to throw an IllegalArgumentException when the account is constructed with a negative balance, when a negative amount is deposited, or when an amount that is not between 0 and the current balance is withdrawn. Write a test program that causes all three exceptions to occur and that catches them all.
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
Sure Below is the modified BankAccount class We throw an IllegalArgumentException at three places Wh... View full answer
Get step-by-step solutions from verified subject matter experts
