I'm not sure where the error in the if statement is, any help is appreciated.
import java.util.Scanner; public class Exercise4P94 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int carNum;
boolean chck;
do {
chck = true;
System.out.println("Enter the Car Model Number: ");
carNum = input.nextInt();
if (carNum == 119 || carNum == 179 || carNum >== 189 && carNum <== 195 || carNum == 221 || carNum == 780){
System.out.println("Your car is defective and must be repaired");
} else if (!(carNum == 119 || carNum == 179 || carNum >= 189 && carNum <= 195 || carNum == 221 || carNum == 780)){
System.out.println("Your car is not defective");
} else {
System.out.println("Please enter a valid car model number");
chck = false;
}
} while (chck);
}
}
You don't need two equal signs after a greater/less than sign
carNum >= 189 && carNum <= 195