Here is the code:
public class CarLoan {
public static void main(String[] args) {
int carloan = 10000;
int loanlengh = 3;
int interestrate = 5;
int downpayment= 2000;
if (loanlengh <= 0 || interestrate <= 0);
System.out.printl("no");
else if (downpayment > carloan);
System.out.printl("thats not how it works");
else
int remainingbalance = carloan -downpayment;
int months = loanlengh * 12;
int monthlybalance = remainingbalance / months;
int interest = placeholder /100;
int placeholder = (monthlybalance * interestrate);
int monthlypayment = monthlybalance + interest;
System.out.println(monthlypayment);
}
}
Here are the errors:
CarLoan.java:13: error: variable declaration not allowed here int remainingbalance = carloan -downpayment;
I don't get the issue.
fixed errors:
CarLoan.java:9: error: 'else' without 'if' else if (downpayment > carloan);