I need my output to look 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 … … … … … … … … …

I'm not sure how to accomplish it. Here is what I have:

I am having two problems that I see so far. The first is that the monthly payments are one line below where they need to be. The second problem is that there is too much of a gap between the monthly payments, so they wrap around.Code:

public class ProgrammingProblemTwo {

public static void main(String[] args){

//declare variables

double r = 0, N = 30, monthlyPayment = 0;

double sum;

System.out.println("Principal 6" + "%" + " 6.5" + "%" + " 7" + "%" +

" 7.5" + "%" + " 8" + "%" + " 8.5" + "%" + " 9" + "%" +

" 9.5" + "%" + " 10" + "%\n");

//create loop to increment principal in dollars, L

for(int L = 100000; L <= 200000; L += 20000){

System.out.println(L);

monthlyPayment = 0;

//create loop to increment interest rate, r

for(r = .06; r <= .10; r += .005){

double temp = 1 + r / 12;

double temp1 = 1;

//create (1 + r / 12) exponent 12N formula

for (int i = 1; i<=12*N;i++){

temp1 = temp1*temp;

}

monthlyPayment = (L*(r/12)*temp1)/(temp1-1);

System.out.printf(" %.0f", monthlyPayment);

}

}

}

}

So I need to figure out how to move System.out.printf(" %.0f", monthlyPayment); up one line.

I also need to figure out how to keep the gap for the first monthly payment but bring the other monthly payments closer together so that they somewhat fit underneath the percentages.