IPC144 Assignment 1
Version 1.1

Clocks

Due: Week of February 4, 2013 (ask instructor for specific date)

As your first assignment this semester, you are to write a C program that adds or subtracts clocks.

Learning Outcome

Upon successful completion of this assignment, you will have demonstrated the abilities to

• code program logic using sequence and selection statements
• perform arithmetic operations on integers
• write program output
• design an algorithm to solve a small problem

Introduction

Time can be stated in 24 hour (Military) format. For example, 5 minutes after one o'clock in the afternoon can be stated as 13:05 hrs. If we include seconds, then 5 minutes and 24 seconds after one o'clock in the afternoon could be stated as 13:05:24 hrs.
The range for the hour portion of the time is from 00 to 23 while for the minute and second, the range is from 00 to 59.
Note that 00:00:00 hrs represents midnight while 12:00:00 represents noon.
Also note that the hour, minute and second are each represented by two digits and are delimited by colons (:).

Specifications

Your program prompts for and accepts the following information:

• the time on the first clock
• the time on the second clock
• the operation to perform
• a plus (+) sign means add clock two to clock one giving clock three
• Adding clock two to clock one implies moving clock one forward by the amount of time shown on clock two.
• a minus (-) sign means subtract clock two from clock one giving clock three
• Subtracting clock two from clock one implies moving clock one backward by the time shown on clock two.

EXAMPLEs

`    00:00:00 - 00:00:01 = 23:59:59    01:01:01 - 23:59:59 = 01:01:02    01:01:01 - 00:00:02 = 01:00:59    23:59:59 + 00:00:01 = 00:00:00    01:01:59 + 00:00:01 = 01:02:00    01:01:01 + 23:59:59 = 01:01:00`

You may assume that the user shall input this information correctly.

Design your program so that it displays clock three, the result of adding or subtracting clocks.

At the beginning of your program, include comments with the following information formatted neatly, and reflecting accurate information about yourself and your submission:

 ``` /* * Course Code * Assignment Number  * Your Name * File Name * Date * * Very Short Program Purpose * */ ```

Submission Requirements

Test your program on the C platforms that your instructor has specified.  For submission purposes, your program must work on matrix, our Linux cluster. For detailed submission requirements follow your instructor's assignment submission guidelines.

STUDENT OATH

A signed declaration of honesty must be included your the assignment.

```I declare that the attached assignment is wholly my
own work in accordance with Seneca Academic Policy.  No part of this
assignment has been copied manually or electronically from any
other source (including web sites) or distributed to other students.

Name   ________________________   Student ID  _________________
```