CS285 -- Lab 2: Message Class

-->Quiz 1
-->Lab 1
->Lab 2
-->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
->Electronic Submission
->Old Exams
->C++ Examples
->MSVC Info
->STL Help
->Book Errata
->Tentative Schedule
->Support Forum
->Course Policies


Fall 2002

Objectives Addressed

  • Understand and apply complex data structures and algorithms.
  • Use appropriate algorithms (and associated data structures) to solve complex problems.
  • Have a thorough understanding of the Standard Template Library.
  • Be able to use data structures in software design and implementation.


This laboratory was developed by Dr. Chris Taylor.


Build a robust Message class that describes an email message. The class should have a two pass reading mechanism. The first pass should read only the email header information from an input stream and record information about where the message is located within the file. The second pass should retrieve the entire contents of the email message. You may wish to consult the Random Access in input streams example for information on how to go to a specific location in an input stream.

Your Message class should have methods to display:

  • Message summary (containing From, Date, Size, and Subject information (perhaps truncated if too long) all on one line (approximately 80 characters))
  • Complete header information
  • Summary header information (From, Subject, X-Original-Date fields only (each on its own line))
  • Message body

You should test your class by writing a program that reads in the email header information for all of the files in 2002Aug.zip (must unzip). The program should indicate the total number of messages in the file and the "Message summary" for all of the messages dated August 12, 2002 as well as the complete contents of the fourth email message dated August 22, 2002.

Lab report (due 4:00pm, Friday of week 4)

Your report should include:

  • A discussion of how you approached the problem. This should contain a sufficient level of detail to convince your instructor that you were thinking as you worked on this assignment.
  • The Documented source code for your program.
  • Sample program output.
  • A brief description of any problems you encountered or questions you have regarding the lab.
  • A summary of your activity log indicating how much time you spent on the assignment (following the template provided in the lab2.xml template document). Please use the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Documentation
    • Other
  • Any suggestions you have for how the lab could be improved.

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 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.

IMPORTANT NOTE: Be sure to save your program for future use. We will be using this assignment in next week's lab assignment.

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.

© 2001-2002 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: Mon Sep 9 11:57:25 2002
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.