Gary0422
07-14-2005, 12:27 PM
Hello fellow programmers,
I am in need of assistance. I am building a Javascript-only DOS Mortgage Loan Calulator. I'm having difficulty inserting a "for" loop that will allow the program to continously calculate each month's payment and interest paid for that month until the loan is ressolved (0.00 balance)
Mortgage Amount: 200,000.00
Loan term: 30 years
Interest Rate: 5.75%
Here's what I have so far;
-----------------------------------------------------------------------
import java.awt.*;
import javax.swing.*;
import java.text.NumberFormat;
class MortgageGary {
public static void main(String[] arguments) {
double amount = 200000.00;
double term = 30;
double rate = 5.75;
double monthlyInterestRate = rate / 1200;
double monthlyPayment = amount * (monthlyInterestRate /
(1 - Math.pow((1 + monthlyInterestRate), -(term * 12))));
double remainingAmount;
double monthlyInterest;
// double remainingPayment = remainingAmount * (monthlyInterestRate /
//(1 =2D Math.pow((1 + monthlyInterestRate), = (term * 12))));
NumberFormat usDigits = NumberFormat.getCurrencyInstance();
String payment = usDigits.format(monthlyPayment);
System.out.println ();
System.out.println("The Total Mortgage Amount is $200,0000.00");
System.out.println("The Interest Rate for Duration of Loan is 5.75%");
System.out.println("The Duration of Mortgage is 360 months");
System.out.println("The monthly mortgage payment is " + payment);
System.out.println();
for (double payment; remainingAmount > 0; dex++)
{
int multiple = remainingAmount * (monthlyInterestRate /
(1 - Math.pow((1 + monthlyInterestRate), -(term * 12))));
}
} }
-------------------------------------------------------------------------
Can anyone provide me some insight as to how to insert a "for" loop so that the program can continuously count down each month's payment and interest paid until the mortgage loan is at 0.00 balance?
Any Assistance would be greatly appreciated..:o)
Gary0422
I am in need of assistance. I am building a Javascript-only DOS Mortgage Loan Calulator. I'm having difficulty inserting a "for" loop that will allow the program to continously calculate each month's payment and interest paid for that month until the loan is ressolved (0.00 balance)
Mortgage Amount: 200,000.00
Loan term: 30 years
Interest Rate: 5.75%
Here's what I have so far;
-----------------------------------------------------------------------
import java.awt.*;
import javax.swing.*;
import java.text.NumberFormat;
class MortgageGary {
public static void main(String[] arguments) {
double amount = 200000.00;
double term = 30;
double rate = 5.75;
double monthlyInterestRate = rate / 1200;
double monthlyPayment = amount * (monthlyInterestRate /
(1 - Math.pow((1 + monthlyInterestRate), -(term * 12))));
double remainingAmount;
double monthlyInterest;
// double remainingPayment = remainingAmount * (monthlyInterestRate /
//(1 =2D Math.pow((1 + monthlyInterestRate), = (term * 12))));
NumberFormat usDigits = NumberFormat.getCurrencyInstance();
String payment = usDigits.format(monthlyPayment);
System.out.println ();
System.out.println("The Total Mortgage Amount is $200,0000.00");
System.out.println("The Interest Rate for Duration of Loan is 5.75%");
System.out.println("The Duration of Mortgage is 360 months");
System.out.println("The monthly mortgage payment is " + payment);
System.out.println();
for (double payment; remainingAmount > 0; dex++)
{
int multiple = remainingAmount * (monthlyInterestRate /
(1 - Math.pow((1 + monthlyInterestRate), -(term * 12))));
}
} }
-------------------------------------------------------------------------
Can anyone provide me some insight as to how to insert a "for" loop so that the program can continuously count down each month's payment and interest paid until the mortgage loan is at 0.00 balance?
Any Assistance would be greatly appreciated..:o)
Gary0422