Java Mortgage Calculator Problem…?
- Asked By: MoneyTactics
- Category: Mortgage Interest Calculator
Problem: A program written in Java (without a graphical user interface) that will calculate and display the monthly payment amount to fully amortize a $200,000.00 loan over a 30 year term at 5.75‰ interest.
The good news is the code is compiling without errors. The bad news is I am having difficulty getting the loan to fully amortize and display the payments as the loan principle decreases. Can someone please help?!?!?!? Here is the code I have so far:
import java.text.*;
public class mortgage
{
public static void main(String[] args)
{
//declaration statements
int length=30; // 30 year mortgage
double balance =200000.00; //amount borrowed
double rate=5.75;
double monthly_payment = 0.00;
double monthly_principal=0.00;
double monthly_interest = 0.00;
NumberFormat currency=NumberFormat.getCurrencyInstance();
double y_rate = (rate /100/12);
double monthly_payments = balance * ( y_rate / (1 – Math.pow((1+y_rate),-1*(length*12) ) ));
y_rate = (rate/100)/12;
System.out.println(“ttMortgage Payment Formula”);
System.out.println(“ttBalance own is $200,000″);
System.out.println(“ttYearly interest rate is 5.75%”);
System.out.println(“ttThe length of loan is 30 yearsn”);
// start of loop to calculate interest paid and balance owe
// print statement as balance increment,as interest increment
for (int mpi =1; mpi<=length*12; mpi++) { // months of payment being decrimented start counter
monthly_interest = (balance*y_rate);
balance = (balance – monthly_principal);
monthly_principal = (monthly_payment – monthly_interest);
System.out.println("Balance is $" + currency.format(balance));
System.out.println("Interest paid is $" + currency.format(monthly_interest));
try {Thread.sleep(10);} catch (InterruptedException e){}
}
}
}
Incoming search terms:
- java mortgage calculator
- java code for mortgage payment calculator
- fha mortgage calculator mpi
- amortization code in java
- mortgage payment calculator amortization in java code
- looping on currency java to display currency
- java interest calculator with loops
- java code to display amoratization
- java code mortgage payment calculator with amortization
- java code for mortgage amortization calculator
HomeworkJAVA
Posted 3 months ago
Please rate as best answer
HEre is proper code
import java.text.*;
public class mortgage
{
public static void main(String[] args)
{
//declaration statements
int length=30; // 30 year mortgage
double balance =200000.00; //amount borrowed
double rate=5.75;
double monthly_payment = 0.00;
double monthly_principal=0.00;
double monthly_interest = 0.00;
NumberFormat currency=NumberFormat.getCurrencyInstanc…
double y_rate = (rate /100/12);
double monthly_payment = balance * ( y_rate / (1 – Math.pow((1+y_rate),-1*(length*12) ) ));
y_rate = (rate/100)/12;
System.out.println(“ttMortgage Payment Formula”);
System.out.println(“ttBalance own is $200,000″);
System.out.println(“ttYearly interest rate is 5.75%”);
System.out.println(“ttThe length of loan is 30 yearsn”);
// start of loop to calculate interest paid and balance owe
// print statement as balance increment,as interest increment
for (int mpi =1; mpi<=length*12; mpi++) { // months of payment being decrimented start counter
monthly_interest = (balance*y_rate);
balance = (balance – monthly_principal);
monthly_principal = (monthly_payment – monthly_interest);
System.out.println("Balance is $" + currency.format(balance));
System.out.println("Interest paid is $" + currency.format(monthly_interest));
try {Thread.sleep(10);} catch (InterruptedException e){}
}
}
}
Other Questions
- Can I itemize my mortgage interest paid in my taxes?
- Do mortgage lenders pull credit reports multiple times during the refinance process?
- how do they calculate the mortgage payment with interest?
- How long after a foreclosure is there an auction?
- If mortgage tax & interest forms are only in my name but multiple owners can they file my forms under thir nam?
Problem: A program written in Java (without a graphical user interface) that will calculate and display the monthly payment amount to fully amortize a $200,000.00 loan over a 30 year term at 5.75‰ interest.
The good news is the code is compiling without errors. The bad news is I am having difficulty getting the loan to fully amortize and display the payments as the loan principle decreases. Can someone please help?!?!?!? Here is the code I have so far:
import java.text.*;
public class mortgage
{
public static void main(String[] args)
{
//declaration statements
int length=30; // 30 year mortgage
double balance =200000.00; //amount borrowed
double rate=5.75;
double monthly_payment = 0.00;
double monthly_principal=0.00;
double monthly_interest = 0.00;
NumberFormat currency=NumberFormat.getCurrencyInstance();
double y_rate = (rate /100/12);
double monthly_payments = balance * ( y_rate / (1 – Math.pow((1+y_rate),-1*(length*12) ) ));
y_rate = (rate/100)/12;
System.out.println(“ttMortgage Payment Formula”);
System.out.println(“ttBalance own is $200,000″);
System.out.println(“ttYearly interest rate is 5.75%”);
System.out.println(“ttThe length of loan is 30 yearsn”);
// start of loop to calculate interest paid and balance owe
// print statement as balance increment,as interest increment
for (int mpi =1; mpi<=length*12; mpi++) { // months of payment being decrimented start counter
monthly_interest = (balance*y_rate);
balance = (balance – monthly_principal);
monthly_principal = (monthly_payment – monthly_interest);
System.out.println("Balance is $" + currency.format(balance));
System.out.println("Interest paid is $" + currency.format(monthly_interest));
try {Thread.sleep(10);} catch (InterruptedException e){}
}
}
}
Incoming search terms:
- java mortgage calculator
- java code for mortgage payment calculator
- fha mortgage calculator mpi
- amortization code in java
- mortgage payment calculator amortization in java code
- looping on currency java to display currency
- java interest calculator with loops
- java code to display amoratization
- java code mortgage payment calculator with amortization
- java code for mortgage amortization calculator
HomeworkJAVA
Posted 3 months ago
Please rate as best answer
HEre is proper code
import java.text.*;
public class mortgage
{
public static void main(String[] args)
{
//declaration statements
int length=30; // 30 year mortgage
double balance =200000.00; //amount borrowed
double rate=5.75;
double monthly_payment = 0.00;
double monthly_principal=0.00;
double monthly_interest = 0.00;
NumberFormat currency=NumberFormat.getCurrencyInstanc…
double y_rate = (rate /100/12);
double monthly_payment = balance * ( y_rate / (1 – Math.pow((1+y_rate),-1*(length*12) ) ));
y_rate = (rate/100)/12;
System.out.println(“ttMortgage Payment Formula”);
System.out.println(“ttBalance own is $200,000″);
System.out.println(“ttYearly interest rate is 5.75%”);
System.out.println(“ttThe length of loan is 30 yearsn”);
// start of loop to calculate interest paid and balance owe
// print statement as balance increment,as interest increment
for (int mpi =1; mpi<=length*12; mpi++) { // months of payment being decrimented start counter
monthly_interest = (balance*y_rate);
balance = (balance – monthly_principal);
monthly_principal = (monthly_payment – monthly_interest);
System.out.println("Balance is $" + currency.format(balance));
System.out.println("Interest paid is $" + currency.format(monthly_interest));
try {Thread.sleep(10);} catch (InterruptedException e){}
}
}
}
Other Questions
- Can I itemize my mortgage interest paid in my taxes?
- Do mortgage lenders pull credit reports multiple times during the refinance process?
- how do they calculate the mortgage payment with interest?
- How long after a foreclosure is there an auction?
- If mortgage tax & interest forms are only in my name but multiple owners can they file my forms under thir nam?
Categories
Recent Search Terms
- can you deduct mortgage interest from rental property income as an expense
- 349000 mortgage
- low fico score va home loans
- what does refinancing a car mean
- is it dumb to keep on double paying mortgage payment
- how long do you have to own your house before you can refinance
- get mortgage credit score 660
- how much intrest can i expect with a 660 credit score
- mortgage interest deduction phase out calculator
- old vs new road bike


Bored
Posted 3 months ago
You declare “double monthly_payment”
Then later you declare “double monthly_payments”
The second one ends with an s. You also never use it.
Delete “double monthly_payment = 0.00;” and rename “double monthly_payments” to “double monthly_payment”