public class mortCalcSR1
{
public static void main (String[] args)throws InterruptedException
{
double loanAmount = 200000;//The principal amount of the loan//
int term = 30;//The terms of the loan in years//
double interest =.0575;//The interest rate on the loan//
double monthlyPayment; //The monthly payment of the loan//
double currentPrincBalance=0;//This is the current balance of the principal only //
monthlyPayment=(loanAmount*(interest/12))/(1-(Math.pow(1/(1+interest/12),(term*12))));//Calculates the interest rate.//
System.out.println("Monthly Payment is $"+ monthlyPayment);//Prints the monthy payment//
//Change request #1//
double loanBalance=0;//variable holding the loan balance//
double InterestPaid=0;//variable holding the interest paid on the loan//
int lineCount=0;//variable holding the counting of the lines//
while loanBalance=(loanAmount-monthlyPayment);//takes the laon amount and subtracts the monthly payment//
interestPaid=(monthlyPayment*interest);//this calculates the monthly interest//
{
if (loanBalance <=0){ //if the laons balance is less than zero the following will print//
System.out.println("Congratulations, you now own your home!");//prints the the loan has been apis off//
}
if (loanBalance>0){//if the laons balance is more than zero, the following will print//
System.out.println("Loan balance is $"+loanBalance);//displays the loan balance//
System.out.println("Your accumulated interest paid is"+interestPaid);//displays the interest that has been paid on the loan//
}
if(lineCount=30){//counts the lines up to 30 each interval//
Thread.sleep(5000);//takes a 5 second pause//
throw InterrupedException;//allows for interruption//
}
}
}
}
I am getting the following error:
C:\Users\Public\Documents\AXIA\Java\mortCalcSR1.java:21: '(' expected
while loanBalance=(loanAmount-monthlyPayment);//takes the laon amount and subtracts the monthly payment//
^
C:\Users\Public\Documents\AXIA\Java\mortCalcSR1.java:21: ')' expected
while loanBalance=(loanAmount-monthlyPayment);//takes the laon amount and subtracts the monthly payment//
^
2 errors
Tool completed with exit code 1
Can you help me understand why? I have been trying to fix this for three days and am at a loss. I have tried every form of using the ")" and nothing seems to work. I need advice from a programmer. Thank you kindly for your help.

New Topic/Question
Reply




MultiQuote




|