Error message?

https://www.codecademy.com/courses/learn-java/projects/loan-payment-calculator

I cannot understand why it is wrong. Can someone explain me what is wrong exactly?
I got this error message:

CarLoan.java:21: error: cannot find symbol
int interest = (monthlyBalance * interestRate) / 100;
^
symbol: variable monthlyBalance
location: class CarLoan
CarLoan.java:22: error: cannot find symbol
int monthlyPayment = monthlyBalance + interest;
^
symbol: variable monthlyBalance
location: class CarLoan
2 errors

```

public class CarLoan {
public static void main(String args) {

// A simple Car Loan Calculator

int carLoan = 10000;
int loanLength = 3;
int interestRate = 5;
int downPayment = 2000;

if (loanLength <= 0 || interestRate <= 0) {
  System.out.println ("Error! You must take out a valid car loan.");
}
else if (downPayment >= carLoan) {
  System.out.println ("The car can be paid in full");
}
else {
int remainingBalance = carLoan - downPayment;
int months = loanLength * 12;
int monthlyBalance = remainingBalance / months;
int interest = (monthlyBalance * interestRate) / 100;
int monthlyPayment = monthlyBalance + interest;
System.out.println (monthlyPayment);
  
}

}

}

<do not remove the three backticks above>

The code you posted compiles successfully, the problem is not with the code you posted

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.