- This assignment is comprised of modifying your program which will calculate a monthly
amoritzed amount (e.g. a house mortgage). For this program, you are to add error checking if
the user enters invalid numeric data, such as the string two (see below);
otherwise perform the calculations and the error checking as in the previous program. The behavior
and layout of this program should be as in the example below. Total points for
this assignment will be 50 points. This assignment is due on or before
Thu, Oct 24..
All objects and techniques necessary for this assignment have been (or will be) covered
in class. The program should look and function as follows:
Enter loan amount: 100000
Enter rate: 6
Enter number years: 30
The monthly payment is: $599.55
Would you like to calculate again (y/n): y
Enter loan amount: 1000000
Enter rate: two
You must enter positive numeric data!
Would you like to calculate again (y/n): y
Enter loan amount: -100000
Enter rate: 6
Enter number years: 30
You must enter positive numeric data!
Would you like to calculate again (y/n): n
- The formula to use for this assignment should be the same as previous programs.
- You must set the names of all objects/variables included in your
program to have meaningful names with correct naming conventions.
- You should refer to the programming guidelines and
follow all guidelines presented there. Failure to adhere to any of the assignment
specifications/programming guidelines will result in loss of points.
- Make sure to keep a copy of the source code that you turn in.
- Please feel free to ask questions/send e-mail if any items require clarification.
Hints & Updates
: (updated Thu, Oct 25th)
- You might need to reset your input values to zero, in the case of valid data the first run and an
exception the next. Pay attention to the examples above.
- You will need to use a try-catch block to catch invalid input, such as two. Refer to the discussion
and the notes presented in class.
- You must get all data as String data, and convert it using the Double.parseDouble() method. I suggest using
the in.nextLine() method for getting the all data as String input as discussed in class.
- You will need to use the String.equals(string2) method as described in class.
- As before, no sloppy control statements (e.g. return, continue, exit, etc.) may be used.
- I suggest using data type of double for this assignment.
- Make sure you modify the input values for Rate and Years as specified in class.
- You must use the NumberFormat.getCurrencyInstance() method presented in class to format your output