Question: Question 1: Write a java code with class named Clock that meets the following requirements: The class has three instance variables: One of type int

Question 1: Write a java code with class named Clock that meets the following requirements: The class has three instance variables: One of type int called hours, another of type boolean called isticking, and the last one of type Integer called diff. The class has a constructor that takes three parameters: an int for hour, a boolean for isTicking, and another int for diff. The constructor constructs a Clock with the specified values. A method named increment with no arguments and no return value. It increases the hours by 1 if the hour is less than 12. A method named decrement with no arguments and no return value. It decreases the hours by 1 if hour is greater than 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
