In the following Time and TimeDriver class skeletons, replace the italicized
a)In the Time class, provide a method definition for the setHours method such that setHours can be called as part of a method-call chain.
b)In the TimeDriver class, provide a single statement that chains calls to the setHours, set-Minutes, setSeconds, and printTime methods. Use reasonable values for your method-call arguments. If you pass 8 to setHours, 59 to setMinutes, and 0 to setSeconds, then your method-call-chaining statement should print this:
08:59:00public class Time{private int hours;private int minutes;private int seconds;//**********************************************************public Time setMinutes(int minutes){this.minutes = minutes;return this;} // end setMinutespublic Time setSeconds(int seconds){this.seconds = seconds;return this;} // end setSeconds//************************************************************public void printTime(){System.out.printf("%02d:%02d:%02d\n", hours, minutes, seconds);} // end printTime} // end Time classpublic class TimeDriver{public static void main(String[] args){Time time = new Time();}} // end TimeDriver class
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.