How can this Math.floor() solution only fail for the colour red?
package com.codegym.task.task04.task0416;
/*
Crossing the road blindly
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
double t = Double.parseDouble(reader.readLine());
double T = Math.floor(t);
if ((T+1) % 5 == 0)
System.out.println("red");
if ((T+2) % 5 == 0)
System.out.println("yellow");
else
System.out.println("green");
}
}