|
Overview
In this lab, you should become proficient at file I/O and string parsing. Procedures
Since June 25, 2002, I have recorded the amount of time it takes me to get to work. The file commute.txt contains my records for commute times. The first few lines of the file are included below: # Date Commute time to work # mm:ss.hs or hh:mm:ss # If * after time then trip was not direct # If d after time then had accident or detour # ... Tue Jun 25 10:39:06 CDT 2002 19:29.05 Wed Jun 26 10:25:32 CDT 2002 17:58.65 Thu Jun 27 09:42:47 CDT 2002 19:35.10 Fri Jun 28 10:44:14 CDT 2002 37:41.55* Lines that begin with a # symbol are comments and should be ignored. Comment lines may appear anywhere in the file (not just at the beginning). Each line containing a data point indicates the date of the commute, the time I arrived in my office, and the time required for the commute. Typically the time is indicated in the following format: mm:ss.hs where mm represents minutes, ss represents seconds, and hs represents hundredths of seconds. In a few cases the time is indicated in the following format: hh:mm:ss where hh represents hours. Two additional characters (* and d) may appear after the time. Typically none of the characters appears; however, any combination of them may appear on a line. The order in which they appear may not be consistent. The meaning of the symbols is given in the comments at the beginning of the file. Write a program that will read the data file, calculate a number of statistics, and write them to an output file. Your output file should include the following statistics:
Just for Fun
If you are looking for an extra challenge you may want to include other statistics in your results (be sure to meet the minimum requirements before doing extra). There are lots of other things you could find, but here are some ideas:
Lab report (due 11:00pm, the day prior to week 6 lab)
Here is a template file to use as a starting point for this report. The lab report does not need to be self-contained. Your report should include:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well. Your grade will depend on quality of design, clarity of code and documentation, as well as whether your program produces the correct results. If you have any questions, consult your instructor. Acknowledgment
This laboratory assignment was developed by Dr. Chris Taylor. |
© 2001-2015 Dr. Christopher C. Taylor | Office: CC-36C | Phone: 277-7339 |