Hello, I am hoping to get some advice on what I might be doing wrong. This is the second program I wrote but I am still very new at writing any JAVA code so please bear with me.
Instructions are - Create a Mortgage Calculator to display the original loan amount, current interest rate, principal paid, and remaining balance. If the list scrolls off of screen, use loops to display a partial list,
hesitate, and then display more of the list.
A list prints but no calculations are not displayed. Here is what it looks like - and it does not break. I am sure it has to do with the way I am calling for calculations or maybe I am missing a "{" or something else.
Any suggestions will be greatly appreciated.
run:
Month1
Monthly Payment isNaNInterest Paid isNaNPrincipal Paid isNaNRemaining Balance isNaNMonth2
Monthly Payment isNaNInterest Paid isNaNPrincipal Paid isNaNRemaining Balance isNaNMonth3
Monthly Payment isNaNInterest Paid isNaNPrincipal Paid isNaNRemaining Balance isNaNMonth4
Monthly Payment isNaNInterest Paid isNaNPrincipal Paid isNaNRemaining Balance isNaNMonth5
public class CathyAlomariMortgageCalculator
{
private static Object[] remaningBalance;
public static void main(String[] args)
{
//main method starts here
//variables defined
double monthlyPayment = 1167.15;
double remainingBalance = 200000.00;
double interestPaid = remainingBalance * 0.0575/12;
double principalPaid = monthlyPayment - interestPaid;
remainingBalance = remainingBalance - principalPaid;
//loop starts here
for(int counter=1;counter <= 30*12;counter++)
{
System.out.println("Month"+ counter);
monthlyPayment =1167.15;
float $ = 0;
float n = 0;
System.out.printf("Monthly Payment is"+$%.2f/n,monthlyPayment);
interestPaid = remainingBalance * 0.0575/12;
System.out.printf("Interest Paid is" + $%.2f/n,interestPaid);
principalPaid = monthlyPayment-interestPaid;
System.out.printf("Principal Paid is" + $%.2f/n,principalPaid);
remainingBalance = remainingBalance-principalPaid;
System.out.printf("Remaining Balance is" + $%.2f/n,remaningBalance);
}
int limit = 11;
int count = 1;
while (count < limit){
thread.sleep(1500);
}
}
}
//end program