Question: help please! Java.clock You will complete the implementation of Clock, which is a 24-hour clock. 1. Implement getters and setters for all private variables in


You will complete the implementation of Clock, which is a 24-hour clock. 1. Implement getters and setters for all private variables in the class Clock: getHro setHro.getMin) setMin () getSec() setSeco Make sure that the setters don't set the time to an invalid number. 2. Implement the tick() method as follows Advance the time by 1 second. Make sure the resulting time is still valid. Example: If current time is 5:12:59, after one call to tick it should be 5:13:00 . Main.java x Clock.java x 1 2 3 4 ** ASSIGNMENT Implement getters and setters for all private variables. Your setters should also include if statements to make sure the value is valid (24-hour clock) valid hours are from 0 to 23 valid minutes are from 0 to 59 valid seconds are from 0 to 59 5 6 7 8 00 9 10 11 12 Complete the implementation of the tick() method Then test it in Main.java Make sure the resulting time is valid **/ public class clock { private int hr; private int min; private int sec; 13 14 15 16 17 18 public void tick() { 19 20 } 21 22 23 public void tellTime() { System.out.println(hr+" : "+min +" : "+sec); } 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
