433-142 Computing Fundamentals B

Semester 2, 2001


Project A: Character Analysis


Submission Deadline: Wednesday 22th August, 2001
Marks: 5% of subject total
 

Problem Specification

The aim of this project is to perform some simple character analysis.

Your task is to write a program in C which reads a series of characters from standard input and calculates the number of upper case letters, lower case letters, numeric digits, whitespace characters, control characters and punctuation characters in the series.

Your program should prompt the user for the input characters (follow the example). Your program should then process input characters, one at a time, until an "end of file" character is encountered. Once the EOF (end of file) character is typed the program should output the absolute number and percentage (to two decimal places) of upper case letters, lower case letters, digits, whitespace,  control characters, and punctuation characters in the series (separated by tabs).  Your program should output "Empty File" if it encounters an empty string. Please refer to the following examples. The output of your program must be identical to the output of the following examples (including spacing).

Important Notes
 

  1. The EOF (end of file) character should NOT be considered as a part of the input string.
  2. For the purpose of this project, a whitespace character is defined to be a character for which the library function isspace() returns a non-zero (true) value, and similarly a control character is one for which the library function iscntrl() returns a non-zero (true) value.


 
 
 
 

Examples

The following input:
$ projA
Start Typing :-
Show Me The $10,100 :) ^E^D

should produce the output:
Type            Frequency       Percentage
==========================================
Uppercase       3               12.50
Lowercase       6               25.00
Digits          5               20.83
Space           5               20.83
Control         1               4.17
Punctuation     4               16.67
 

$ projA
Start Typing :-
U-are-2-good-2-b-true^T-"yes"^D

Type            Frequency       Percentage
==========================================
Uppercase       1               3.57
Lowercase       15              53.57
Digits          2               7.14
Space           0               0.00
Control         1               3.57
Punctuation     9               32.14

NOTE: (In the examples above , control D or ^D stands for the EOF character and it is not counted as a part of the string.)

$ projA
Start Typing :-(I enter control-D to signify an empty string.)
Empty File      (My program outputs "Empty File".)
 
 

Questions and Answers

A QandA page has been established at www.cs.mu.oz.au/142/projAQandA.html,
and will be considered to be part of the specification of the project.You should check this page periodically while you are completing your project; and before mailing a query to Saeed or myself, check that your question has not already been answered.
 
 
 

Submission

You must submit a single file named projA.c, which contains an ANSI C program meeting the given specifications. If you have worked on this project using a computer running the Windows operating system, format your source file using the dos2unix program found on unix machines prior to submission. Submit your single C source file using the command:

        submit 142 A projA.c
You should later verify your submission using
        verify 142 A > projA.record
        more projA.record
and check that your program successfully compiled. Then keep the file projA.record as your "receipt" for your submission. Detailed instructions on submit and verify are in Student Manual Volume A and on the accompanying CD-ROM.

Deadline

The deadline for on-time submission is 5pm, Wednesday 22th August, 2001. Projects submitted after this date/time will be penalised.

Students who have medical or personal reasons for seeking extensions should do so by email to murli (murli@cs.mu.oz.au). Note that "workload", "my part time job", and "I'm going to be away" will not normally be accepted as reasons for granting extensions, since their impact should have been anticipated at an early stage.

Be aware that the labs will get busy in the last few days prior to submission. The heavy load on the computers also means that system problems are more likely to occur in the last few days than they are at other times. These effects mean that it will take you much longer to complete your project in the last few days than it will if you start earlier. Best strategy: start early and submit early.

Marking

This project counts for 5% of the subject total. Marking will be based upon the following factors:


 
 

Individual Work

You are reminded that all submitted assignment work in this subject is to be your own individual work. You are free to discuss possible approaches to programming problems with your classmates, but should not exchange written material, either on paper or electronically, and should not let other students copy your program. Students submitting the work of others for assessment will be penalised by the Department, and risk prosecution under the University's Discipline Regulations. Please refer to the section on Principles of Responsible Student Behaviour in the Student Manual A if you need clarification in this matter. Put simply: don't cheat - it's not worth it.