I have been at this for the past 2 hours and I think I have finally come close to a workable solution. I wrote down the numbers on a notepad of all the green numbers (1,2,5,6,9,10... etc). I then figured out that it was easier to isolate the red and yellow numbers since there were significantly fewer of them. I was able to see a commonality for each red and yellow. Red are all multiples of 4 and yellow is a difference of 4 between values with the exception of 3 which is the first yellow value. My code works for all the numbers except for any number that's yellow apart from 3. The reason so far that I have deduced that is is because I put t == 3. When I run the numbers 7,11,15 and so on through the compiler it returns green in the console. I know I am missing something small so if someone can help me understand what that is I would greatly appreciate it.
package com.codegym.task.task04.task0416;
/*
Crossing the road blindly
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
InputStream inputStream = System.in;
Reader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String minutesOfHour = bufferedReader.readLine();
int t = Integer.parseInt(minutesOfHour);
if (t % 4 == 0 && t <= 60){
System.out.println("red");
} else if (t == 3 || t - 4 == 4){
System.out.println("yellow");
} else {
System.out.println("green");
}
}
}