Question: Write a class named Clock that meets the following requirements: The class has two instance variables: a type int called hour, a type int called
Write a class named Clock that meets the following requirements: The class has two instance variables: a type int called hour, a type int called minute. The class has a constructor that takes two parameters: an int for an hour, an int for a minute. The constructor constructs a Clock with the specified values. A method named increment with no arguments and no return value. It increases the minute by if the minute is less than A method named decrement with no arguments and no return value. It decreases the minute by if minute is greater than The hour and minute are changed accordingly as the increment or decrement methods change the minute. Write a test program that creates a Clock with XP hour minute and then invokes the increment method five and then displays the current hour and minute; invoke the decrement method ten times and then displays the current hour and minute.
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
