Question: In java, write a class named Clock that meets the following requirements: The class has three instance variables: One of type int called hours, another
In java, write a 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
if the hour is less than
A method named decrement with no arguments and no return value. It decreases the hours by
if hour is greater than
Write a test program that creates a Clock with hour isTicking false, and diff and then
invokes the increment method once and then the decrement method once.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
