Question: Please answer #10 only .. 9. A digital clock shows hours (between 0 and 23) and minutes (between 0 and 59). Once a minute, it
Please answer #10 only


.. 9. A digital clock shows hours (between 0 and 23) and minutes (between 0 and 59). Once a minute, it receives a pulse to advance the time. Complete the Clock class, using instance variables for the hours and minutes. Clock.java 1 /** 2 A simulated digital clock. 3 */ 4 public class Clock 5 { 6 private int hours; 7 private int minutes; 8 9 10 Advances this clock to the next minute. 11 12 public void pulse() 13 { 14 15 } 16 17 /** 18 Gets the hours of this clock. 19 @return the hours (between 0 and 23) 20 21 public int getHours() 22 { 23 24 } 25 26 /** 27 Gets the minutes of this clock. 28 @return the minutes between 0 and 59) 29 */ 30 public int getMinutes() 31 { 32 33 } 34 } Clock Tester.java 1 public class ClockTester 2 { 3 public static void main(String[] args) 4 5 Clock myClock = new Clock(); 6 for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
