CS 117, Introduction to Computer Science
Project 5: Word frequencies. Project due Monday 10/23/00.
Design document due by Wednesday 10/18/00.
CHANGE: words with same frequency may be printed in any order.
The Goal
You are going to write a program that
-
asks the user for the name of a text file,
-
reads the words from the file, keeping track of their frequencies (that
is, how many times each word appears),
-
and prints the complete list of words and their frequencies, sorted in
decreasing order by frequency (words with the same frequency may be printed
in any order).
So, for example, if the file contains the text:
The moose and the kudu
frolicked in the
meadow with their friends
the okapi and the gnu.
the output should be:
the 5
and 2
friends 1
frolicked 1
gnu 1
in 1
kudu 1
meadow 1
moose 1
okapi 1
their 1
with 1
Note that punctuation should be removed, and that "the" and "The" are considered
to be the same word.
Design
This project is the biggest we've done in this class so far. It is essential
that you break the project up into functions so that you can manage your
time, as well as debug it more easily. On Wednesday, 10/18/00, you should
turn in a design document containing the following information:
-
Prototypes of the functions that you will use to solve the problem
-
Descriptions of the purpose for each of these functions
-
Descriptions of the variables, arrays, etc. you will need to store and
manage the information
-
Pseudocode for each of the functions
-
Estimates of how long it will take you to write each of these functions.
Consider how long it will take to translate the pseudocode into actual
C++ code, then remember to leave lots of time for debugging and testing.
-
Your test plan: how will you test each of these functions individually
to make sure they work?
You should plan on getting each of your functions to work independently.
Among the many benefits of this approach is the constant availability of
a partial solution that can be handed in for grading, or demonstrated to
a customer, or released to the public for early testing.
You should start coding your project before turning in the design
document. Rapid prototyping of your ideas is a good way to validate your
design.
Good luck!!!