p1 - CMSC 106 Project#1 Fall 2011 Date assigned Monday Date...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC 106 Project #1 Fall 2011 Date assigned: Monday, September 19, 2011 Date due: Wednesday, September 28, 11:00 p.m. 1 Introduction The purpose of this project is to become familiar with the tools needed to complete projects for this course and to practice input, output, variable types, and mathematical expressions. 2 Project specifications Times are sometimes represented in computers as a certain number of seconds or minutes past a given starting time. Therefore, in programming, it is often necessary to convert hours and minutes to seconds, or vice versa. Your task in this project will be to write a small C program which prints CMSC106, and also reads a time, converts it to seconds, and prints two additional facts about it. This is just practice in using the facilities of C covered so far. Write a C program which produces several lines of output as described (see the sample execution in Section 7): The first output line contains only the string CMSC106. Your program is then to ask the user to type a time, and read the time entered. The time will consist of two integers, representing hours and minutes respectively, with a single colon appearing between them. The time entered will be in 24–hour time, so the value 14:15 would signify 15 minutes past 2:00 p.m., and 1:15 would signify the time 15 minutes past 1:00 a.m. On the next line your program is to print the input time, the number of seconds past midnight this time will occur, and the percentage of how far into the day this time will be. The hours and minutes in the printed time should be separated by a colon, each printed using two positions. If the number of hours is a single digit it should be printed with a preceding blank space, and if the number of minutes is a single digit it should be printed with a preceding zero. For example, the time five minutes past eight should be printed as ±8:05 (using ± to indicate a printed space). The percentage figure should be printed as a number between zero and 100, equal to the nearest whole number not greater than the percentage value. For example, since a day is 24 hours, at time 12:00 it will be 50% over, and 75% over at 18:00. Also see the example below. The percentage figure must be immediately followed by a percent sign (%), not separated from the number by any space. The next line must contain the number of seconds between the input time and the end of the day (at 24:00). The last line tells the current time by a different definition. You are working with the beings on another planet that has observed how long an earth day is. (This is one revolution of the earth - so this is the same as defined by earthlings and beings on this other planet.) But they divide the day into bleeps, blips and seconds. Seconds have the exact same length of time as our seconds. There are 200 seconds in a blip. There are 54 blips in a bleep. There are 8 bleeps in a day. In their format they write the time in bleeps-blips-seconds where the bleeps are always written as a one digit value, the blips are
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

p1 - CMSC 106 Project#1 Fall 2011 Date assigned Monday Date...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online