What's wrong with my code? The error is "unexpected type." It's the if (year % 4.0 = 2.0)
part and the error message is
assignment4part2.java:18: error: unexpected type
if (year / 4.0 = 0.0)
^
required: variable
found: value
The code is as follow:
import java.util.Scanner;
public class assignment4part2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter a number of a month");
double month = input.nextDouble();
System.out.println("Enter a year");
double year = input.nextDouble();
if (month == 1.0) {
System.out.println("January " + year + " had 31 days.");
} else if (month == 2.0) {
if (year % 4.0 = 0.0) {
System.out.println("February " + year + "had 29 days.");
} else {
System.out.println("February " + year + "had 28 days.");
}
} else if (month == 3.0) {
System.out.println("March");
}
}
}