Jim Hackney

Greenhorn
+ Follow
since Apr 17, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jim Hackney

Hello all. This is my first time posting here. I am hoping to get some advice on a homework program I am doing. I am completely lost on this particular program. I am finding nested loops to be very confusing. I tend to "get lost" in them. Here is what I am doing:

I am supposed to write a program that finds the monthly payment for 30 years, for principals from $100,000 through $200,000(with increments of $20,000) and interest rates of 6% through 10% (with increments of 0.5%). The output of the file must be in a table that looks something like this:

Principal 6% 6.5% 7% 7.5% 8% 8.5% 9% 9.5% 10%
100000 600 632 665 699 733 768 804 840 877
120000 719 758 798 839 880 922 965 1009 1053
140000 … … … … … … … … …
160000 … … … … … … … … …
180000 … … … … … … … … …
200000 … … … … … … … … …

The monthly payment on mortgage loan of L dollars, at a rate of interest "r" is given by:

Monthly payment = [L(1 + r/12)exponent 12N ]/[(1 + r/12)exponent 12N - 1]

where N = number of year mortgage (30 years).

The professor gave us this hint:



I have tried adding his loop as the first loop, the second loop and the last loop to no avail. I've tried putting the last System.out.println(monthlyPayment) within the first for loop curly bracket, the second and the last. I am completely at a loss. Here is the latest I tried:



I would appreciate it if someone could steer me the right direction.
12 years ago