at firs read i though about a loop, but i couldn't figure out how to do it, so i do it with paper so i think as it follow double a = (t/5.00); divide insert time for 5 double b = 0; b= t-(a*5); insert ime - (correct numer of ciclo) /* if (b>=0 && b,3) System.out.println("yellow"); else if(b>=4 && b<5) System.out.println("red"); else System.out.println("green");* but it was't working, a friend give me the attached solution, but i guess till i don't undesand it i can't solve it.