Question: implement the InvestmentCalculator with a method called calculate _ future _ value that takes three parameters: principal _ amount, annual _ interest _ rate, and
implement the "InvestmentCalculator" with a method called calculatefuturevalue that
takes three parameters: principalamount, annualinterestrate, and years. The
calculatefuturevalue method should calculate the future value of an investment using
the formula: futurevalue principalamount annualinterestrate years.
Use trycatch blocks to handle exceptions where the user inputs a negative interest rate
or an invalid nonnumeric value for any of the parameters.
If a negative interest rate is inputted, raise an ArgumentError with a message explaining
that the interest rate cannot be negative.
Catch the ArgumentError and any other generic exception, printing a custom message to
the console for each case.
Wrap the user input section in a while loop that continues prompting the user until valid
inputs are received, and the future value has been successfully calculated and displayed.
Example result
Valid input
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
