Question: Language is Java 2) Write a separate class ClockDemo with a main() method. The program should: .instantiate a Clock object firstClock using one integer seconds
2) 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 tick() 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 of the secondClock 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 third Clock that should reference to object of difference of firstClock and secondClock by calling the method subtractClock()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
