UMBC CMSC201, Computer Science I, Spring 1994 Sections 0101, 0102 and Honors

Project 4

Due: April 28, 1994

Click here for the latest news and hints.

Objective:

The objective of this assignment is to practice making design decisions using top-down design and to practice manipulating characters and strings.

Assignment:

Imagine that you work for the editor of a publishing house where the authors write books that are too long. Your assignment is to write a program that allows the editor to trim down the books by removing every other word, every third word, etc. from the text. Your program should first ask the user for the number of words to skip before deleting a word. For example, if this number is 2, then every third word is deleted. So,
This is the time for all good women and men to come to the aid of their country.
would become
This is time for good women men to to the of their .
Your program should preserve all spaces and punctuation. Also, your program must work over multiple lines, continuing to receive input until the user enters a line that starts with a period. Here is a sample run of the program:
Enter number of words to skip: 1

Original Text> Space, the final frontier.  These are the
Deleted  Text> Space,  final .  These  the

Original Text> voyages of the starship Enterprise.
Deleted  Text>  of  starship .

Original Text> Its continuing mission to explore strange new     
Deleted  Text> Its  mission  explore  new     

Original Text> worlds; to seek out new  life, and
Deleted  Text> ; to out   life, 

Original Text> new civilizations; to boldly go where no
Deleted  Text> new ; to  go  no

Original Text> one has gone before.
Deleted  Text> has  before.

Original Text> .
In addition to correctness, your program will be graded according to how well you break up this larger problem into smaller pieces. So, think before you code.

Implementation Notes

Your program should adhere to the following guidelines.

What to turn in:

Inside the script environment, run your program on the text of the Star Trek prologue as shown above using 1, 5 and 25 as the number of words to skip. When you are done, exit from script, and send in your project and typescript file:
  % cat project4.c typescript | mail chang@gl.umbc.edu
Remember that your program will be judged on overall style, design and correctness and not just on the output that it produces on these particular test cases. (I.e., you probably want to test your program on examples that you make up yourself.)
Last Modified: June 10, 1994

Richard Chang, chang@gl.umbc.edu