Question: After this, we need to test our clock in a tester class. Use the default constructor, prompt user to input specified time (hrs, mins, and

 After this, we need to test our clock in a tester

After this, we need to test our clock in a tester class. Use the default constructor, prompt user to input specified time (hrs, mins, and seconds). reset using reset method. print results. Advance it by one second and reprint.

Let's use your calendarDate class from last week as a guide to create a Clock class. Create a file named Clock.java. Here, we want to create an instance class named Clock that contains the following variables, methods, and constructors: Private instance variables that store hours (0-23), minutes (0-59), and seconds (0-59). A constructor that initializes the hours, minutes, and seconds to values specified by the parameters. A default constructor with no parameters that sets the hours, minutes, and seconds to 0. A method named reset that resets the hours, minutes, and seconds to 0. It will have no parameters. . An overloaded reset method that resets the hours, minutes, and seconds to values specified by the parameters. It will have three parameters. A method named advance that advances the clock by one second. If seconds has now reached 60. reset seconds to 0, and increment the minutes. If, after incrementing minutes, minutes has now reached 60. reset minutes to 0, and increment the hours. If, after incrementing hours, hours has now reached 24, reset hours to 0. A toString method that returns hours, minutes, and seconds as a string of the form "h:m:s" You should end up with a total of 6 public methods, and 3 private attributes. Compile your ving on to test it

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!