title: Traffic light program. Java. Loops
body: <p>My code is getting complicated and it doesn't seem to be getting resolved, please, have a look and give me advice.
  Please, make sure you do not share a solution as I'd rather fix it by me, instead of leaving it unclear.
  Here we go:</p>
  <p>TASK:
  The pedestrian traffic light is programmed as follows:
  at the beginning of each hour, the green signal is on for three minutes,
  then the signal is yellow for one minute,
  and then it is red for one minute.
  Then the light is green again for three minutes, etc.
  Use the keyboard to enter a real number t that represents the number of minutes that have elapsed since the beginning of the hour.
  Determine what color the traffic light is at the specified time.
  Display the result as follows:
  &quot;green&quot; if the light is green,
  &quot;yellow&quot; if the light is yellow, and
  &quot;red&quot; if the light is red.</p>
  <p>EXAMPLE:
  For 2.5 - Green.
  For 3 - Yellow.
  For 5 - Green.
  and so on, within 60 minutes loop.</p>
  <p>MY CODE:</p>
  <pre><code>     public static void main(String[] args) throws NumberFormatException, IOException {
      
       BufferedReader sum = new BufferedReader(new InputStreamReader(System.in));
       double a;
      
      a = Double.parseDouble(sum.readLine());
      
      while(true) {
       calcYellow(a, a); break;}
      while(true) {
       calcRed(a, a); break;}
      while(true) {
       calcGreen(a, a, a, a); break;}
  
      }
      
      static void calcYellow(double a, double b) {
        double a1 = 3.0;
        double b1 = 3.5;
      for (a=a1+4; a&lt;60; a++);
      for (b=b1+4; b&lt;60; b++);
        if ((a%3.0==0) || (a%3.5==0));
        if ((b%3.0==0) || (b%3.5==0));
      
      System.out.println(&quot;Yellow&quot;);
        }
  
      static void calcRed(double a, double b) {
        double a1 = 4.0;
        double b1 = 4.5;
      for (a=a1+4; a&lt;60; a++);
      for (b=b1+4; b&lt;60; b++);
      if ((a%4.0==0) &amp;&amp; (a%4.5==0));
      if ((b%4.0==0) &amp;&amp; (b%4.5==0));
      
      System.out.println(&quot;Red&quot;);
      }
  
      static void calcGreen(double a, double b, double c, double d) {
      double a1 = 1.0;
      double b1 = 1.5;
      double c1 = 2.0;
      double d1 = 2.5;
      for (a=a1+4; a&lt;60; a++);
      for (b=b1+4; b&lt;60; b++);
      for (c=c1+4; c&lt;60; c++);
      for (d=d1+4; d&lt;60; d++);
      
      System.out.println(&quot;Green&quot;);
  }       
      }
  </code></pre>
  <p>Any advice will be highly appreciated.
  TY in Advance!</p>