Question
Please answer this question. Account class and testAccount exist in this site. please use throw illegal argument exception in account class. and use try catch
Please answer this question. Account class and testAccount exist in this site. please use throw illegal argument exception in account class. and use try catch in main class.
Program #3 (24 points): Modify class account from assignment #8 to throw illegal argument exception if the initial balance amount, deposit amount, withdraw amount, or interest rate is less than or equal to zero. Modify the test program to show how invalid negative values for these variables would throw illegal argument exceptions Use proper and meaningful error messages. The following is a sample run that shows the result of calling method toString() on an object followed by the output for an attempt to withdraw a negative amount from the account. ----jGRASP exec: java -ea TestAccountWithExceptions
Account ID: 123456 Account Balance: $7,000.00
Interest Rate: 2.5% Monthly interest: $14.58
Date Opened: Fri Nov 09 12:08:27 EST 2018
Invalid Input: Withdraw amount must be positive.
----jGRASP: operation complete.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started