Department of Computer Science

Problem Solving and Algorithm Design I

Spring Semester 2010

Dr. Maury Eggen

Homework Laboratory Exercise 7

For this homework assignment we shall study the use of functions, arrays of characters, ASCII representation, and counting.

You are to write a program which will prompt the user for the name of a file containing a large body of text. You will read the text, character by character into an array of characters. The goal is to do a character study on the text.

However, in this case we are only interested in alphabetic characters, and we wish to NOT consider case. Thus the first task is to process the text, converting all of the upper case characters to lower case. Then we will compress the text, making a new text array, keeping only the alphabetic characters, eliminating all others.

We will then study this array, counting the frequency of each of the characters. How many a's? How many b's? etc.

Our display should tell the total number of characters read, the total number of non-alphabetic characters, the total number of alphabetic characters, and a frequency table, telling the character name, the number of that character, and the percentage of the total.

Character	Frequency	Percent of total
a		20		11.2%
b		4		3.1%
etc.
Homework requirements are the same as before, title page, description, source code, sample execution, and meaningful story.

Homework due date: Friday, March 5, 2010.

Return to Dr. Eggen's Home Page