The Week Three IA is not a continuation of the Week Two IA. The major requirements for the Week Three IA are:

1.Prompt the user to input a loan amount. Value validation is needed.

2.Use arrays to store the three pairs of loan term and rate. Be sure the term and rate are paired correctly.

3.Calculate and display 3 loans in columns.

Here are the steps:

1.Create a basic working program. It is a file called XXXWeek3.java. XXX is your last name. The file name and the main class name should match to avoid runtime symbol not found problem. The program should have only the public static void main method with no processing code. Compile and run the program to make sure there is no error.

2.Add the following code inside the static void main method.

a.Declare a variable for the loan amount. You can set it to a default value.

b.Declare two arrays, one to store the 3 loan terms and another to store the three loan rates specify in the requirement. Be sure each term and rate pair has the same array indices.

c.Prompts the user to enter a loan amount. To prompt the user, you can use the Java Console class. The reference link is:

The Oracle tutorial link is:

Depending how you prompt the input. If the input value is a string, it needs to be converted to the proper data type (double or int) before it can be used in the calculation. The Java Double and Integer classes have methods to do the conversion. Their reference links are:

Note: The Double and Integer classes are not the same as the double and int primitive data types. The calculation uses the primitive data value double and int.

d.Check user invalid input value. The user input cannot be a zero, a negative value or a non-numeric value. (See my special posting on using the try and catch blocks).

e.Display the Loan amount

f.Display the column headings for the loan term, loan rate and mortgage payment.

g.Loop to calculate the three mortgage payment amounts. The mortgage formula can be found in the two links below:


h.Inside the loop, show the loan term, loan rate and mortgage payment amount. You may want to show the amount in a currency format (2 digits after the decimal). You can use the Java’s DecimalFormat class. Its reference link is:

Its Oracle tutorial link is:

I hope this write-up helps. Start your IA early, always save your last working version, add code incrementally. Java is case sensitive, be careful you’re your typing. Asking questions is important and please be specific, and do not post your entire code with the question. You can post section of the code and a screen shot.