Change the number and variety of data fields without altering methods? : <p>I'm including my Java assignment below. I'm a bit puzzled by the instructions. I am supposed to use a new data field. The class is supposed to only have one data field. I am not, however, supposed to alter the methods. I don't really have any idea how to do this and make it work without altering the methods.</p>

<blockquote>
  <p>Modify the Time2 class (below) to implement the time as the number of seconds since midnight. The class should have one data field (an int with the number of seconds since midnight) instead of three. This change should not affect the arguments, behavior, or output of the public methods.</p>
</blockquote>

<pre><code>public class Time2 {

    private int hour; // 0 - 23

    private int minute; // 0 - 59

    private int second; // 0 - 59


public Time2() {this(0, 0, 0);}

public Time2(int hour) {this(hour, 0, 0);}

public Time2(int hour, int minute) {this(hour, minute, 0);}

// Time2 constructor: hour, minute and second supplied

public Time2(int hour, int minute, int second) {

    if(hour&lt;0||hour&gt;=24)

        throw new IllegalArgumentException("hour must be 0-23");

    if (minute &lt; 0 || minute &gt;= 60)

        throw new IllegalArgumentException("minute must be 0-59");

    if (second &lt; 0 || second &gt;= 60)

        throw new IllegalArgumentException("second must be 0-59");

this.hour = hour;

this.minute = minute;

this.second = second;

}

public Time2(Time2 time) {this(time.getHour(), time.getMinute(), time.getSecond());}

// Set Methods

// set a new time value using universal time;

// validate the data

public void setTime(int hour, int minute, int second) {

    if (hour&lt;0||hour&gt;=24)

        throw new IllegalArgumentException("hour must be 0-23");

    if (minute &lt; 0 || minute &gt;= 60)

        throw new IllegalArgumentException("minute must be 0-59");

    if (second &lt; 0 || second &gt;= 60)

        throw new IllegalArgumentException("second must be 0-59");

    this.hour = hour;

    this.minute = minute;

    this.second = second;

}

public void setHour(int hour) {

    if (hour &lt; 0 || hour &gt;= 24)

        throw new IllegalArgumentException("hour must be 0-23");

    this.hour = hour;

}

public void setMinute(int minute) {

    if (minute &lt; 0 &amp;&amp; minute &gt;= 60)

        throw new IllegalArgumentException("minute must be 0-59");

    this.minute = minute;

}

public void setSecond(int second) {

    if (second &lt;= 0 || second &gt; 60)

        throw new IllegalArgumentException("second must be 0-59");

    this.second = second;

}

public int getHour() {return hour;}

public int getMinute() {return minute;}

public int getSecond() {return second;}

// convert to String in universal-time format (HH:MM:SS)

public String toUniversalString() {

    return String.format( "%02d:%02d:%02d", getHour(), getMinute(), getSecond());

}

// convert to String in standard-time format (H:MM:SS AM or PM)

public String toString() {

    return String.format("%d:%02d:%02d %s",

            ((getHour() == 0 || getHour() == 12) ? 12 : getHour() % 12), getMinute(), getSecond(), (getHour() &lt; 12 ? "AM" : "PM"));

    }

} 
</code></pre>
