SYCS-135
INTRODUCTION TO PROGRAMMING
Assignment
8
Due
Date: November 16, 1999
Problem: Your
consultant on the Year 2K problem has just been involved in a skiing accident
in Colorado and will be unable to return to work for several weeks. Today is
Friday and you have 2 weeks to meet a deadline for completing the necessary
modifications for upgrading a number of application programs to be Year 2000
compatible. Your manager has agreed that you can use the company�s very
experienced top programmer for 1 week, and a junior programmer recently hired
from Howard University for 2 weeks, starting on Monday. In order to allocate
the work in the most effective way, you have decided to write a program that
will read in the documentation of the applications under scrutiny, and count
the frequency of keywords such as Date, Year, 2000 etc. Your consultant has
assured you that he kept the documentation up to date, so your plan is to
isolate the code that has the most references to the keywords associated with
dates and give this code to the top programmer, assuming that this code will
require the most modification. The rest of the code you will give to the junior
programmer.
So your job is to determine the number of
times the following keywords appear in each paragraph of the documentation:
year, years, date, dates, 2000, Y2K, and any date 1900 to 1999. Any alphabetic
character can be upper case or lower case. Thus date is counted the same as
Date for frequency purposes.
Input: Create a text file "applic.txt"
containing the following paragraph followed by at least 2 more paragraphs of
documentation that you make up yourself.
To modify
DEDUCTION_1 to account for Year 2000 compatibility, check for dates 1979-1999
taking into account year 1900. Years before 1979 should be handled using the
Y2K routine A, years >= 1979 should be handled using the OLD_1 routines.
There is at least one blank after each
punctuation character and surrounding each mathematical symbol (e.g., <= )
symbol. Words have a maximum of 20 characters and can contain alphabetic
characters, digits and underscore characters only. Paragraphs are separated by
one or more blank lines.
In your C++ program name your external input
file applic.txt and include the following combined declaration and open
statement in your program:
ifstream aread
= "applic.txt";
Output: Your
output should present, in a neat and readable manner the following:
Your name, the
course number, assignment number and date, and problem description.
The applications�
documentation exactly as written in applic.txt.
After each
paragraph, a statement giving the frequency counts in the paragraph, of the
following four categories of names or symbols:
Category�������������������� Sequence of characters�������������������� Meaning
Year���������������������������� "year" or
"years"���������������������� singular
or plural of word year
Date���������������������������� "date" or
"dates"���������������������� singular
or plural of word date
Year 2000������������������� "2000" or
"Y2K"��������������������� Nomenclature
for year 2000
Prior Years������������������ "19NM"���������������������������������� N and M are
integers chosen
from 0 -> 9.
Examples of the
last category, Prior Years, are 1904, 1987, 1998.
For example, if applic.txt
included only the first paragraph listed above, the frequency counts output
would be:
For paragraph
1:
Frequency of
Year = 4
Frequency of
Date = 1
Frequency of
Year 2000 = 2
Frequency of
Prior Years = 5
Special Requirements: Use enumeration types, arrays, strings and the
<string.h> library functions.
Assignment Submission: On November 16th hand in a hard copy of your
algorithm in pseudocode, your test oracle and desk-checking calculations, your
C++ program compilation listing, and your output obtained from running your
program with the external file "applic.txt". SCS users will
also submit their programs electronically on November 15th, see below.
Pseudocode: A 1-page description of your algorithm in pseudocode.
Test Oracle: Write at least 2 additional paragraphs of
documentation and use your algorithm to calculate by hand the frequency counts.
Program
Documentation: At the top of your
source code as a comment, include your name, course number and title,
assignment number, and date, followed by a description of the problem. Include
comments as necessary throughout your program to illustrate the algorithm,
logic of flow, meaning of variables etc. Follow the style guidelines described
in class.
ELECTRONIC
SUBMISSION - SCS
All C++ program assignments are now to be
submitted electronically. Your program will be run using the instructors� data.
For Assignment 8, name your C++ program file assign8.c and use the following
command to submit your program:
$ Keeling assign8.c
The assignment is to be submitted electronically
no later than 10:00pm on November 15, 1999. All assignments are automatically
time-stamped and no late assignments will be accepted. If before the deadline,
you send in a version of your assignment, having already sent in an earlier
version, the later version will automatically replace the earlier version in
the assignment file.