Exercise 04: Enhancing Class Time2

Date completed: 04/07/2018

Modify class Time2 from the previous exercise, Exercise 02, to include a tick method that increments the time stored in a Time2 object by one second. Provide method incrementMinute to increment the minute by one and method incrementHour to increment the hour by one. Write a program that tests the tick method, the incrementMinute method and the incrementHour method to ensure that they work correctly. Be sure to test the following cases:

  1. incrementing into the next minute,
  2. incrementing into the next hour and
  3. incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).

The Created Code

The source code can be found here. It has been compressed in to a 7-Zip file.

Some screen prints

Description Screen Print Out
The output from the created code as seen in Eclipse. java_s07_ex04 image