title: Converting 24 hour clock to 12 hour java
body: <p>Okay so I have a clock class which is initially set as a 24 hour clock but I have to have the clock display as a 12 hour clock using only this method! I have tried for hours but have fallen short! Please help.  Make the clock display the time as a 12 hour clock (hh:mm:ss AM/PM). Use abstraction - don’t change anything but the updateDisplay() method. The clock can use military time "under the covers"; it just needs to return the proper string when getTime() is called. </p>
  
  <pre><code>private void updateDisplay()
  {
      String AM = "AM";
      String PM = "PM";
  
      if(hours.getValue() == 0) {
          hours.setValue(hours.getValue() + 12);
          PM = "";
      }
      else if(hours.getValue() == 1 &lt; hours.getValue() &amp;&amp; hours.getValue() &lt; 11) {
          PM = "";
      }
      else if(hours.getValue() == 12) {
         AM = "";
      }
      else if(hours.getValue() == 13 &gt; 24) {
          hours.setValue(hours.getValue() - 12);
         AM = "";
      }
  
      displayString = hours.getDisplayValue() + ":" + 
      minutes.getDisplayValue() + ":" +
      seconds.getDisplayValue() + PM + AM;
  }
  </code></pre>