SE-0010 Introduction to Java
Lab 3: Interest Calculator with Error Handling

Outcomes

Assignment

For this assignment, you will modify the CD interest calculator you began last lab. You will implement selection and iteration statements (if...else and while) to handle certain cases of invalid user input, as well as the ability to re-run the program with different input values.

Your program will still consist of a single InterestCalculator class, with the same methods as before. For this assignment, make the following changes to the methods:

getInitialValue - modify this method so that it checks to make sure the initial value entered for the CD is not null, not blank, and that the value is greater than 0 and less than 100000. If a correct value is not entered, print an error message similar to the one shown below and repeat the input prompt until the user enters a valid value.

getInterestRate - modify this method so that it checks to make sure the value entered for the interest rate of the CD is not null, not blank, and the value is greater than 0 and less than 100. If a correct value is not entered, print an error message and repeat the input prompt until the user enters a valid value.

getInterval -  modify this method so that it checks to make sure the value entered for the interval is not null, not blank, and the value is greater than 0 and less than 10. If a correct value is not entered, print an error message and repeat the input prompt until the user enters a valid value.

computeCDValue - No changes

displayResults - No changes.

main method - Continue to print a JOptionPane-based welcome screen at the start of the program. After the main method displays the results, add instructions that prompt the user whether they want to re-run the calculations for a different set of inputs, as shown below. If the user response is negative or they press Cancel or the Close icon), the program should end.

Test your program and make certain that it works correctly; use the results shown above to verify your output.

Remember: This is an individual assignment. While you may discuss the concepts with your classmates, you must write your own program. You may not copy or borrow code from your classmates.

Lab Submission (due 8:00am, Wednesday following lab)

Submit your completed Java program via via WebCT (assignment "Lab 3: Interest Calculator with Error Handling").. For this program, your program will consist of a single .java file.

Be sure to keep a copy of your work, in case something gets lost.

Your grade will be based on the following criteria: