Project #1

Due Date: Thursday, September 26, 2002








The main goal of project #1 is to get you reacquainted with the Ada programming language and some common control structures. The project also requires you to build a program from scratch, which will give you a little practice in doing so. For, the majority of the projects this class you will be building on other code.

In this project you will develop a program to generate a histogram for letters used in a text document. A histogram is a statistical graph of a frequency distribution, where the height of vertical rectangles is proportional to their corresponding frequencies. The idea of the program is to read a text file, count the occurrences of each letter and calculate their frequencies then display the histogram on the screen as seen below (you don't have to put in the table borders):
 
10%
*
 9%
 
 8%
 
 7%
 
 
 
*
 6%
 
 
 
*
 
*
 5%
*
 
 
*
 
 
 
* * *
 4%
*
 
 
*
 
 
*
*
 
 
* * * * *
 3%
*
*
 
*
 
*
 
 
*
 
*
* * * *
 2%
*
*
*
*
*
*
 
*
*
 
*
*
*
*
*
*
 
*
*
*
*
*
 1%
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
 
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
 

 

Program requirements:
  1. Accept a file name input by the user from the keyboard (this should include prompts for program control).
  2. Read the text file input by the user. If it does not exist let the user know.
  3. Calculate the frequency of each letter used in the file.
  4. Display the results similar to the example shown above. Remember the program must handle all situations, such as, a file containing only the letter l. In this case the graph could not be scaled 1 to 10%, but from 1 to 100%. How the graph is scaled will be left up to you, but when displayed the entire frequency range must be used (i.e. if the letter t has the highest frequency, then the column corresponding to the letter t must include an asterisk in every row of the graph)
You will need to use a couple of Packages to implement this program they are the Ada.Text_IO and the Screen packages.
 
What to submit:
Submit your project in the form of a Case Study as described in Feldman/Koffman and done in CSci 51. You may attach this assignment sheet as a problem statement, then write the Design, Test Planning, Implementation, and Testing sections, referring to this sheet where appropriate. Deliverables should include:
*Document for your algorithm with detailed explanations.
*Code -- a listing (.lsb) file 
*Source Code -- .adb 
*Document for your test plan
*Test Results -- a printout (turnin script)
Zip all 5 of these files into a zip archive using your last name, that is, lastname.zip.
Email the zip file to your TA, be sure to include cs131 on the subject line of your email. 
 
Grading:
Grading for this first project will be 0-20 points, as follows: Design: 0-2, Test Plan: 0-4 Program Implementation 0-10, Code style and layout, 0-4.