CS 1620 Assignment #4 Fall 2000
How to handin.
Points : 50
Due : Thursday Oct 26, 2000 @ midnight
Note : Late assignments will be accepted only with the instructor's pre-approval.
Marks will be awarded for comments, style,
readability, compiling and working correctly.
- [10] Problem 8, page 164 in textbook
- [10] Problem 9, page 164 in textbook
- [10] Problem 2, page 223 in textbook
- [10] Write a program that reads two integers separated by an
operator such as +, -, x, /, and % (there are spaces between the
operator and the operands), and outputs the result of the
operation. For example :
| If the inputs are | The output should be |
| The operation | The result |
| 23 + 12 | 35 |
| 12 x 6 | 72 |
| 142 / 12 | 11 |
| 146 % 11 | 3 |
| 23 - 12 | 11 |
- [10] Write a program that converts times from 24 hour
notation to 12 hour notation. For example, it should convert 14:25
to 2:25 PM. For example :
| If the inputs are | The output should be |
| Time in 24 hour notation | Time in 12 hour notation |
| 9:25 | 9:25 AM |
| 12:25 | 12:25 PM |
| 14:23 | 2:23 PM |
| 14:63 | Wrong Time !!! |
| 24:23 | Wrong Time !!! |
Hints:
- You should read the input time as a string, i.e., there are
no spaces between the hour, the colon and the minutes.
- The numeric value of a digit character is int(digit) - int('0')
Assignment List | Prev | Next | Computer Science 2620
Department of Mathematics & Computer Science
University of Lethbridge Home Page