Question: please write in java You will complete the implementation of Clock, which is a 24-hour clock 1. Implement getters and setters for all private variables
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: getiro setHro getMino setMin getSec() setSeco) Make sure that the setters don't set the time to an invalid number Main.java 1 public class Main 2 3 public static void main(String[] args) { 4 Clock c1 = new Clock(); 5 c1.setHr(10): 6 c1.setMin(59); 7 c1.setSec (59); 8 c1.tick(); 9 ci. tellTime(): 10 11 12 } 13 14 } 15 2. Implement the ticko) 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 ticko) it should be 5:13:00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
