CS182 -- Final Project: Text Formatting



->Courses
->CS182
-->Homework
-->Quiz 1
-->Lab 1
-->Lab 2
-->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
->Project
->Electronic Submission
->MSVC Info
->Tentative Schedule
->Course Policies

[Courses]
[Rich][Home][Rich]
[Author]

Winter Quarter 2000-2001

Overview

The purpose of this project is to apply skills develop throughout the course to a more complex task than typical one week lab assignments.

Procedures

Write a program that will read in a text file (user specified) and format the text so that it is full justified. The user should be able to specify the number of characters per line (between 10 and 120). The results should be written to an output file (user specified).

In the input file:

  • Individual "words" are signified by at least one whitespace character before and after the "word".
  • A "word" may contain punctuation marks.
  • Paragraph breaks are signified by at least one blank line between text.

In the output file:

  • The last character of the final "word" in each line should be located in the nth column, where n is the number of characters per line as specified by the user.
    Note: This does not apply to the last "word" of a paragraph.
  • All "words" that do not end with a period, semicolon, or colon (. ; :) should have at least one space after them. (Unless they are the last "word" on the line.)
  • All "words" that end with a period, semicolon, or colon (. ; :) should have at least two spaces after them. (Unless they are the last "word" on the line.)
  • All paragraphs should be separated by one blank line.
  • All words in the last line of each paragraph should have the minimum spacing (as specified above) after them.

For example, if the following text were given to your program, and the line length were specified to be 40 characters:

While I have not specified exactly how you should do the
justification, part of your   grade
will be based on how visually pleasing your results are.

As a general
  rule, you should strive to reduce the total number
of spaces required and the maximum number of spaces
between two words as much as   possible.

your program should produce an output file that is similar to the following:

While I  have not specified  exactly how
you should do the justification, part of
your grade will be based on how visually
pleasing your results are.

As a general  rule, you should strive to
reduce   the  total   number  of  spaces
required  and  the  maximum   number  of
spaces  between  two words  as  much  as
possible.

In addition, the following statistics should be appended to a log file:

  • The names of the input/output files
  • The number of characters per line
  • Number of paragraphs
  • Number of words
  • Number of spaces required
  • Maximum number of spaces between two words
  • Number of lines in the original file
  • Number of lines in the formatted file

Although not required, you may choose to enhance your program with additional features. For example, you could add an option to select the number of characters to indent each paragraph or add a graphical user interface. Let your imagination run wild, but be sure to do the minimum requirements before embarking on any significant enhancements.

Program Demonstration (week 10 lab)

You will be required to demonstrate your program at the beginning of the week 10 lab session. Programs that are not ready to be demonstrated at the beginning of the lab session will be considered late. In order to demonstrate your program, you will be given a set of input files and asked to run your program on them with specified line lengths. The output files and the log file should be zipped and submited before the end of lab.

Lab report (due 11:00pm, Thursday of week 10)

The lab report should be in your own words and self-contained. By self-contained I mean that it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Purpose (educational objectives)
  • Problem Statement
  • Procedure (the steps you used to design your program, reasons for your design decisions, etc.)
  • Documented source code for your program. You may find it useful to use the code.bat and dump.bat batch files to produce one file containing all of your source code with the markup commands required by my electronic submission process.
  • Discussion (do not include sample program output since I will already have your zipped file with samples, problems you encountered (and how they were overcome), etc.)
  • A summary of your activity log indicating how much time you spent on each phase of the assignment. Please report the time in the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Documentation
    • Other
  • Conclusions (what you learned, suggestions of how the assignment could be improved, things you would have done differently, etc.)

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.

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 Dr. Christopher C. Taylor Office: CC-27C Phone: 277-7339 Last Updated: January 3, 2001
I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to.