Description
CSIS 312 Assignment 1 Time 2 Class
Assignment 1-1
Using the Time2 class of Fig 8.5 of your Deitel & Deitel text, it would be perfectly possible to represent the time internally as the number of seconds since midnight rather than with the three integer values hour, minute, and second. Clients could use the same public methods and get the same results. Modify the Time2 class so that time is represented internally as seconds and then use Time2Test.java to test your modified Time2 class.
Assignment 1-2
Using your modified Time2 class from Assignment 1-1, add a tick method that increments time stored in the Time2 object by one second. Also provide an incrementMinute method to increment the minute by one and an incrementHour method to increment the hour by one. Be sure that you test for cases where incrementing the second, minute, or hour moves your time into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
Reviews
There are no reviews yet.