CS 115 Lab 5 If Control Structures (Individual)

60 Points

Due by Sunday, September 23, midnight
If you turn it in after midnight but before 9:00 am the next day, you will lose half credit. After 9:00 am, you lose all the points. Use the Canvas link to submit your program.

Educational goals of this lab - verify that every student can

The problem:

There are many programs which work with clock time, like payroll programs and calendar programs. Many times two times, expressed as hours, minutes and seconds, need to be compared to determine which one comes first. You can assume for this program that the two times are in the same DAY, and a 24-hour clock is used, so the times range from 0:00:00 to 23:59:59.

There are 3 possible results of comparing two times, Time1 is earlier than Time2, Time1 is later than Time2 or the times are the same.


1. Do NOT convert the times into total seconds - that makes the logic too easy! compare the times piece by piece, hours, then minutes then seconds.

2. Make SURE you are comparing integers and not strings! If you compare strings like "9" and "23" you will be surprised at the result!


Log off properly - you don't want your account misused by someone else!

Remember not to leave files on the local hard drives in this lab or anywhere else on campus! Make sure you save your projects on a portable storage device you take with you!