Create a class called Clock that includes three instance variablesan hour (type int), a minute (type int)
Question:
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.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Question Posted: