- 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 the logic to
print an error if the user enters non-positive numbers for any of the 3 inputs, otherwise perform
the calculations 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
Thur, Oct 10.
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 // run 1
Enter rate: 6
Enter number years: 30
The monthly payment is: $599.55
Enter loan amount: 10000 // run 2
Enter rate: 4.5
Enter number years: 3
The monthly payment is: $297.47
Enter loan amount: -100000 // run 3, bad data
Enter rate: 5
Enter number years: 5
You must enter positive numeric data! // color for emphasis only
- The formula to use for this assignment should be as follows:
- 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 Mon, Oct 24th)
- Be sure to adhere to the formula listed above. Deviating from this will most likely result in erroreous
results.
- You will need at least one decision statement, as well as some logical operators as discussed in class.
- I suggest using data type of double for this assignment. You must use the .nextLine and .parseDouble
methods as discussed in class (see notes).
- No sloppy control statements may be used. Statements not to be used include return, continue, break, exit(), etc. If we didn't discuss the statement in
class, don't use it.
- Make sure you modify the input values for Rate and Years as specified in class.
- You must format the output, either using printf (and %.2f%n) or using the
NumberFormat.getCurrencyInstance() method.