title: How can I print out this private class fields after converting them?
body: <p>I've been working on this assignment for a while and I've hit a wall that I can't figure a way around. The goal of the assignment can be read here, to save me the trouble of typing or copying it.</p>
  
  <p><a href="http://imgur.com/be5YVst" rel="nofollow">http://imgur.com/be5YVst</a></p>
  
  <p>I can't figure out the output portion of the assignment. Because the class had to be set up in such a specific way, and not just to perform a specific function. Even though the assignment says nothing about a toString() or similar method, I started to write one, but realized that I couldn't use the fields, hour, minute, and second because they're out of scope. If I tried to put them in the TimeTest program instead, I won't have permission because they're private. (They HAVE to be private.)</p>
  
  <p>How can I get these converted units to be printed out in the form hour:minute:second?</p>
  
  <p>Below is my current code:</p>
  
  <pre><code>public class Time 
  {
      private long hour;
      private long minute;
      private long second;
  
      public Time()
          {
              long compTime = System.currentTimeMillis();
              this.setTime(compTime);
          }
  
      public Time(long hour, long minute, long second)
          {
              this.hour = hour;
              this.minute = minute;
              this.second = second;
          }
  
      public Time(long time)
          {
              this.setTime(time);
          }
  
      //three get methods
      public long getHour()
          {
              return this.hour;
          }
  
      public long getMinute()
          {
              return this.minute;
          }
  
      public long getSecond()
          {
              return this.second;
          }
      //setTime method
      public void setTime(long elapseTime)
          {
              this.hour = (elapseTime/36000000);
              this.minute = ((elapseTime - (this.hour * 36000000))/60000);
              this.second = ((elapseTime - (this.minute * 60000))/1000);
          }
  
      public String printFormat()
          {
          //it wouldn't let me name it toString() so I named it printFormat() instead.
          }
  }
  </code></pre>