Question: 3.14 (Clock Class) Create a class called Clock that includes three instance variables-an hour (type int), a minute (type int) and a second (type int).

 3.14 (Clock Class) Create a class called Clock that includes three

3.14 (Clock Class) 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

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!