Results 1 to 2 of 2
  1. #1
    fletch07 is offline Member
    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Default New to java and having issues

    So the project is to change the code from a 24 hour clock to a 12 hour clock. when i hit the time 11:59 then time tick forward one minute it goes to 00:00. I had it working where it would go to 12:00 then re-read my directions and it said I can only make changes to timeTick and setTime and either of the ClockDisplay constrictors So I had to remove the code i added in different places.

    now I am stuck can someone just point me in the right direction?
    Code:
    /**
    * This method should get called once every minute - it makes
    * the clock display go one minute forward.
    */
    public void timeTick()
    {
    minutes.increment();
    if(minutes.getValue() == 0) { // it just rolled over!
    hours.increment();
    }
    updateDisplay();
    }
    /**
    * Set the time of the display to the specified hour and
    * minute.
    */
    public void setTime(int hour, int minute)
    {
    if (hour == 0) {
    hour = 12;
    }
    hours.setValue(hour);
    minutes.setValue(minute);
    updateDisplay();
    }

  2. #2
    fletch07 is offline Member
    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Default Re: New to java and having issues

    I figured it out. I went back to a previous code I tried in the time tick and changed the code in the constrictor so the time tick would work properly. I was forgetting that and that is why is it was not working.

Similar Threads

  1. Replies: 2
    Last Post: 09-21-2011, 10:33 AM
  2. Java Issues
    By Sinking_Python in forum New To Java
    Replies: 21
    Last Post: 05-18-2011, 12:10 AM
  3. having issues with this java code...please help out
    By oenhouse in forum New To Java
    Replies: 4
    Last Post: 12-20-2010, 02:21 PM
  4. Issues with a particular website (Java + forms)
    By aromes in forum Advanced Java
    Replies: 1
    Last Post: 04-13-2009, 04:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •