I have tried many implementations of a few different methods for this question... i feel like i've satisfied all the parts of the question. However the compiler is telling me in my last line of code i have an "else" without and "if"... So i cannot check the output. Can someone shed some light on what im not seeing here... been on this problem for a while now. Thanks!
package com.codegym.task.task04.task0414;
/*
Number of days in the year
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//String num = br.readLine();
// int year = Integer.parseInt(num);
int year = 1988;
int x;
if (year % 400 == 0){
x = 366;
System.out.println("Number of days in the year: " + x);
}
else{
x = 365;
System.out.println("Number of days in the year: " + x);
}
else if (year % 4 == 0 && year % 400 == 0 && year % 100 != 0){
x = 366;
System.out.println("Number of days in the year: " + x);
}
else if (year % 100 == 0 && year % 400 == 0);{
x = 366;
System.out.println("Number of days in the year: " + x);
}
else if (year % 400 != 0 && year % 100 != 0 && year % 4 != 0){
x = 365;
System.out.println("Number of days in the year: " + x);
}
}
}