IUP Computer Science
COSC 110   Spring 2002
 

Project #5
(Due 15 April 2002)


The administration at Harrisburg International Airport has an unusual plan to reduce some of their labor costs.  They want to have the people who do the security checking for departures also handle baggage for arrivals.  However, first they need to make a study of the workload for security checking and baggage handling.  That is where you come in - you are to write a program to help with the evaluation of this plan.

The administration will collect all of the flight information for all airlines into one file.  Each line of the file begins with a letter indicator (A for arrival or D for departure).  Following that is a 20 character city name, an aircraft capacity rating (in the range 1 unit to 5 units - 1 is the smallest in capacity, 5 is the largest), and a departure or arrival time.  Below is a small sample:

A Philadelphia         3  20:42
D Philadelphia         3  21:58
A Johnstown            1  16:13
D Johnstown            1  17:30
A Wilkes Barre         2  17:49
D Wilkes Barre         2  19:02
A Toronto              4  20:02
D Toronto              4  21:26

Each arrival causes work for the baggage handlers; the amount of work depends on the capacity rating; and the period of work depends on the time of arrival.  The administration figures that baggage handling is affected during the time from arrival to approximately one hour after arrival.  For flights arriving before the half hour, the current hour is affected.  For flights arriving on or after the half hour, the following hour is affected.  From the example above, the Philadelphia flight has a baggage impact of 3 units during hour 21 (because the flight arrives at 20:42); the Johnstown flight has a baggage impact of 1 unit during hour 16 (because the flight arrives at 16:13).

Each departure causes work at the security checkpoint; the amount of work depends on the capacity rating; and the period of work depends on the time of departure.  The administration figures that security is affected during the time from approximately two hours before a departure up to departure.  For flights leaving before the half hour, the previous hour and the one before that are affected.  For flights leaving on or after the half hour, the current hour and the previous hour are affected.  From the example above, the Philadelphia flight has a security impact of 3 units during hours 20 and 21 (because the flight leaves at 21:58); the Toronto flight has a security impact of 4 units during hours 19 and 20 (because the flight leaves at 21:26).  As you can see from this sample, times are kept track of using the 24-hour clock.

You are to write a program that analyzes the file of flight data and produces two histograms.  Both histograms use time for the vertical axis, showing one line for each hour of the day (0 thru 23).  The first histogram is to show the workload distribution throughout the day, displaying one 'S' for each security work unit in an hour and one 'B' for each baggage work unit in an hour - the horizontal axis is in units of work.  For the small sample above, a portion of the histogram is shown (for hours 16 thru 21).  Naturally, the histogram should be labeled to indicate what is what - labeling is not shown here.

16|SB  2
17|SSS  3
18|SSBB  4
19|SSSS  4
20|SSSSSSSBBBB 11
21|SSSBBB  6

The number at the end of each histogram line is the total number of work units (security and baggage combined) for the hour.

The second histogram is to show the number of flights distribution throughout the day, displaying one 'A' for each arrival and one 'D' for each departure in an hour - the horizontal axis is in flights.  For the small sample above, a portion of this histogram is shown  (for hours 16 thru 21).  Naturally, the histogram should be labeled to indicate what is what - labeling is not shown here.

16|A  1
17|AD  2
18|
19|D  1
20|AA  2
21|DD  2

Your program should prompt for and read in the name of the file containing the flight information.  You may make your own practice data file, using the data given on the first page and possibly adding more of your own.  Just before the program is due, I will give you the official file of flight information that I want you to run your program on.  Your program should process the data in the file and display the two histograms.  Your program is required to use one or two functions to display the histograms and one function to process the data in the file (these are in addition to the main function).

Because the output for this program is too large to fit on the screen, you should batch process the program, as you did for Project #4.   Go to the MS-DOS prompt, execute the program and redirect the output to a file.  Hand in a printout of the program, produced with Visual C++.  Also, hand in a printout of the results captured in a file.  Copy your source file (after naming it yourname5.cpp) to the hand-in folder on the P: drive for this course.