Question: Create a class called Clock that includes three instance variablesan hour (type int), a minute (type int) and a second (type int). Provide a constructor
Create a class called Clock that includes three instance variables—an hour (type int), a minute (type int) and a second (type int). Provide a constructor that initializes the three instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. The set method should set the value of all three variables to 0 if the value of hour is more than 23, the value of minute is more than 59, and the value of second is more than 59. Provide a method displayTime that display the time in an “hh:mm:ss” format. Write a test app named ClockTest that demonstrates class Clock’s capabilities.
Step by Step Solution
3.51 Rating (164 Votes )
There are 3 Steps involved in it
Sure heres how you can create this Clock class and a ClockTest class to demonstrate its capabilities ... View full answer
Get step-by-step solutions from verified subject matter experts
