[Solved]Three Instance Variables Hours Range 0 23 Minutes Range 0 59 Seconds Range O 59 Three Co Q37173713

JAVAThree instance variables for the hours (range 0-23), minutes (range 0-59), and seconds (range o-59) . . Three constructors: default (with no parameters passed; is should initialize the represented time to 12:0:0) o a constructor with three parameters: hours, minutes, and seconds a constructor with one parameter: the value of time in seconds since midnight (it should be converted into the time value in hours, minutes, and seconds) o o Instance methods: o a set-method method setClock() with one parameter seconds since midnight (to be o get-methods getHours(), getMinutes(), getSeconds() with no parameters that return the o set-methods setHours(), setMinutes(), setSeconds() with one parameter each that set o method tick() with no parameters that increments the time stored in a Clock object by o method addClock/) accepting an object of type Clock as a parameter. The method converted into the time value in hours, minutes, and seconds as above). corresponding values. up the corresponding instance variables. one second. should add the time represented by the parameter class to the time represented in the current class. Add an instance method toString() with no parameters to your class. toString() must return a String representation of the Clock object in the form “(hh:mm:ss)”, for example (03:02:34)” o o Add an instance method tickDown) which decrements the time stored in a Clock object by one second o Add an instance method subtractClock() that takes one Clock parameter and returns the difference between the time represented in the current Clock object and the one represented by the Clock parameter. Difference of time should be returned as an clock object Write a separate class ClockDemo with a main() method. The program should: instantiate a Clock object firstClock using one integer seconds since midnight obtained from the keyboard. tick the clock ten times by applying its tickf) method and print out the time after each tick Extend your code by appending to it instructions instantiating a Clock object secondClock by using three integers (hours, minutes, seconds) read from the keyboard. Then tick the clock ten times, printing the time after each tick. . . Add the secondClock time in firstClock by calling method addClock. Print both clock objects calling toString method Create a reference thirdClock that should reference to object of difference of firstClock and secondClock by calling the method subtractClock() Show transcribed image text Three instance variables for the hours (range 0-23), minutes (range 0-59), and seconds (range o-59) . . Three constructors: default (with no parameters passed; is should initialize the represented time to 12:0:0) o a constructor with three parameters: hours, minutes, and seconds a constructor with one parameter: the value of time in seconds since midnight (it should be converted into the time value in hours, minutes, and seconds) o o Instance methods: o a set-method method setClock() with one parameter seconds since midnight (to be o get-methods getHours(), getMinutes(), getSeconds() with no parameters that return the o set-methods setHours(), setMinutes(), setSeconds() with one parameter each that set o method tick() with no parameters that increments the time stored in a Clock object by o method addClock/) accepting an object of type Clock as a parameter. The method converted into the time value in hours, minutes, and seconds as above). corresponding values. up the corresponding instance variables. one second. should add the time represented by the parameter class to the time represented in the current class. Add an instance method toString() with no parameters to your class. toString() must return a String representation of the Clock object in the form “(hh:mm:ss)”, for example (03:02:34)” o o Add an instance method tickDown) which decrements the time stored in a Clock object by one second o Add an instance method subtractClock() that takes one Clock parameter and returns the difference between the time represented in the current Clock object and the one represented by the Clock parameter. Difference of time should be returned as an clock object Write a separate class ClockDemo with a main() method. The program should: instantiate a Clock object firstClock using one integer seconds since midnight obtained from the keyboard. tick the clock ten times by applying its tickf) method and print out the time after each tick Extend your code by appending to it instructions instantiating a Clock object secondClock by using three integers (hours, minutes, seconds) read from the keyboard. Then tick the clock ten times, printing the time after each tick. . . Add the secondClock time in firstClock by calling method addClock. Print both clock objects calling toString method Create a reference thirdClock that should reference to object of difference of firstClock and secondClock by calling the method subtractClock()
Expert Answer
Answer to Three instance variables for the hours (range 0-23), minutes (range 0-59), and seconds (range o-59) . . Three constructo… . . .
OR

