View Single Post
Old Mar 20th, 2005, 6:19 PM   #4
You Like Java?
Newbie
 
You Like Java?'s Avatar
 
Join Date: Mar 2005
Location: aboho.com (sn:eyvind)
Posts: 20
Rep Power: 0 You Like Java? is on a distinguished road
Send a message via AIM to You Like Java? Send a message via MSN to You Like Java? Send a message via Yahoo to You Like Java?
Is this what you wanted?

import java.text.*;
 
class Wk3
{
	 public static void main (String[] arguments) //create main
	 {
		 int term = 30; //init var for length of loan
		 double amount = 200000; //init var for loan amt
		 double pmt = 0; //init var for payment
		 double rate = .0575; //init var for interest rate
		 double rateMo = 0; //init var for monthly interest paid 
		 while (amount > 0)
		 {
			 rate = (rate/12); //divide annual rate to get monthly rate
			 term = (term * 12); //multiply years to get length in months 
			 pmt= (amount * (rate)) / (1-Math.pow(1 + rate, - term)); //compute payment
			 java.text.DecimalFormat dec = new java.text.DecimalFormat(",###.00"); //format next output to dollars.cents
			 System.out.println("\nThis months payment is $" + dec.format (pmt)); //display payment
			 System.out.println ("\nYour loan balance is $" + dec.format (amount)); //display loan amt
			 System.out.println("\nThis months interest is $" + dec.format (amount * (rate ))); //montly interest payment
			 amount -= pmt;
		 }
	 }
}

(Damn vB formatting...)
__________________
If you need help with Java, you can go to javaforum.tk and get answers quickly.

Programmer YouLikeJava = new JavaProgrammer("Eyvind");
YouLikeJava.printInfo();
YouLikeJava.setWeb("You Like Java?");

Last edited by You Like Java?; Mar 20th, 2005 at 6:22 PM.
You Like Java? is offline   Reply With Quote