What's the errors?

I probably should work on reading the console better, but I don’t understand the errors it’s giving me. I’m up to step 15 on the car loan calculator, and when trying to save the code, I have 5 errors. I don’t understand the problems, so can someone please explain what I did wrong? Here is the code I have written:

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

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 (downPayment >= carLoan);
System.out.println("The car can be paid in full.");
  int remainingBalance = carLoan - downPayment
int months = loanLength * 12;
int monthlyBalance = remainingBalance / months;
int interest = monthlyBalance * interestRate / 100;
int monthlyPayment = monthlyBalance + interest;



If you’re getting syntax error I suggest looking up examples for the thing that isn’t recognized.
You can also make a minimal program where you only use that something, so that you can be confident that it isn’t something else causing the problem and that you’re on the right track in your efforts to fix it.

1 Like

else (downPayment >= carLoan);
What exactly do you expect this to do?

Step 7 of the project states:

What if the down payment is more than the price of the car? Add to the if statement and use else if to check whether the down payment is greater than or equal to the car loan.
So I think my code was off, but according to the step, I wanted to check whether the down payment is greater than or equal to the carloan.

if (downpayment > 5)
 do this
else if ( downpayment == 5)
 do that
 do this

You need to remember how if-else if - else conditional branching works
You never give a condition to else

1 Like

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