reset password
Author Message
knagrec2
Posts: 51
Posted 13:42 Nov 06, 2018 |

In 24 hour time, the clock goes form 23:59 - 00:00. Therefore, the highest value for hours should be 23 before rolling to 0. In the instructions, it asks to go to 24, then roll over to 1. Which should we do?

rgallegos
Posts: 29
Posted 13:55 Nov 06, 2018 |

23:59 --> 0000 is what is displayed on clocks so thats what I went with.
I think it just mentions 24 as a reminder. Same as how there's no 60 seconds displayed but 1min:0sec

knagrec2
Posts: 51
Posted 13:57 Nov 06, 2018 |
rgallegos wrote:

23:59 --> 0000 is what is displayed on clocks so thats what I went with.
I think it just mentions 24 as a reminder. Same as how there's no 60 seconds displayed but 1min:0sec

Do you know what happens if time is negative? The instructions say to have a checked exception, but they also say to roll over time backwards. If I roll it over 23:59 to 00:00 or 00:00 to 23:59, wouldn't there be no need for this exception?

kknaur
Posts: 540
Posted 13:58 Nov 06, 2018 |

http://militarytimechart.com/

knagrec2
Posts: 51
Posted 14:00 Nov 06, 2018 |
kknaur wrote:

http://militarytimechart.com/

The website says that both 00:00 and 24:00 are acceptable. Are both acceptable for this assignment as well?

kknaur
Posts: 540
Posted 14:04 Nov 06, 2018 |

Yes.

knagrec2
Posts: 51
Posted 14:07 Nov 06, 2018 |
kknaur wrote:

Yes.

Does this also apply when subtracting time? That is if time goes negative (00:00:00 - 00:00:01) does it go to 23:59:59, or should it throw the NegativeTimeException? The lines in the instructions about NegativeTimeException and rolling back time make me unsure of whether we can roll back time over midnight, or we should just throw exception at that point

kknaur
Posts: 540
Posted 14:25 Nov 06, 2018 |

You can check if the result will be negative and throw the exception.  I may have been unclear in the directions.  I wanted everyone to get more practice with exceptions so don't worry about rolling backwards.  If you already did this I will make a note of it for the grading.

knagrec2
Posts: 51
Posted 14:26 Nov 06, 2018 |
kknaur wrote:

You can check if the result will be negative and throw the exception.  I may have been unclear in the directions.  I wanted everyone to get more practice with exceptions so don't worry about rolling backwards.  If you already did this I will make a note of it for the grading.

I can change it to throw an exception, the rollback was only line anyway.