Want to have this code to search for dates between 1950-2050 and find out when Nothing happened, World cup, Olympic games or the info you write does not match any of the dates.
So the OL occurs when the number between 1950-2050 is divided by 4. And the WC occurs between even years of the OL like 2002(2004 WC)2006.
Then we have the dates no OL/WC occur between 1950-2050, that year nothing happened. And last if you put in like 700 it should just say the last else.
Scanner input = new Scanner(System.in);
System.out.println("Write year between 1950-2050: ");
int keyboard = input.nextInt();
int OL = (keyboard);
int WC = (keyboard);
int nothingspec = (keyboard);
int instru = (keyboard);
if(nothingspec) {
System.out.println("This year nothing special happened.");
}
else if(OL) {
System.out.println("Yes this year it the olympic games. ");
}
else if(WC) {
System.out.println("Yes this year it was a world cup in soccer.");
}
else(instru) {
System.out.println("Your instructions were wrong please try again.");
}
input.close();