< previous page page_320 next page >

Page 320
time for each song, until it encounters a reference number of 0. The times should each be entered in the form of minutes and seconds (two integer values). For example, if song number 4 takes 7 minutes and 42 seconds to play, the data entered for that song would be
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
4 7 42
The program should echo-print the data for each song and the current running time total. The last data entry (reference number 0) should not be added to the total time. After all of the data have been read, the program should print a message indicating the time remaining on the tape.
If you are writing this program to read data from a file, the output should be in the form of a table with columns and headings. For example:
Song
Song Time
Total Time
Number
Minutes
Seconds
Minutes
Seconds
------
-------
-------
-------
-------
1
 5
10
 5
10
2
 7
42
12
52
5
 4
19
17
11
3
10
33
21
44
4
 8
27
32
11
6
 0
55
41
 6
0
 0
 1
41
 6
There are 3 minutes and 54 seconds of tape left.

3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
If you are using interactive input, your output should have prompting messages interspersed with the results. For example:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Enter the song number:
1
Enter the number of minutes:
5
Enter the number of seconds:
10
Song number 1, 5 minutes and 10 seconds
Total time is 5 minutes and 10 seconds.
For the next song,
Enter the song number:
.
.
.
Use meaningful variable names, proper indentation, and appropriate comments. If you're writing an interactive program, use good prompting messages. The program should discard any invalid data sets (negative numbers, for example) and print an error message indicating that the data set has been discarded and what was wrong with it.
4. Using top-down design, write a program that prints out the approximate number of words in a file of text. For our purposes, this is the same as the number of gaps

 
< previous page page_320 next page >