Les H
Posts: 6
Nickname: crazyman65
Registered: Dec, 2009
|
|
Re: Mortgage Homework
|
Posted: Dec 10, 2009 10:36 AM
|
|
This program has been bugging me for days and started searching for help today and came across your site. I have a couple of problems that i just can't figure out. One is how to make the output in to a table format as asked in the directions the other is when I run the code my answers are like the first one 50000 when it should be 500. Can somebody point me in the correct direction. Thanks
Les
class mortgage { public static void main (String[] args) { int L; for (L=100000; L<=200000; L+=20000){ double r; for(r=6; r<=10; r+.5){ int N=30; double temp = 1+r/12; double temp1 = 1; for(int i = 1; i<=12*N; i++){ temp1=temp1*temp; } double mp = (L * (r / 12) * temp1) / (temp1-1); System.out.println("Principal \t 6%\t 6.5%\t 7%\t 7.5%\t 8% \t8.5% \t9% \t 9.5% \t 10%"); System.out.println("100,000 \n 120,000 \n 140,000 \n 160,000 \n 180,000 \n 200,000"); System.out.print("\t"); System.out.printf("$%1.0f\n",mp); } } } }
|
|