CMSC 246 Systems Programming
Spring 2018

Assignment#7: Flights!
Due in class on Monday, April 2, 2018

In this assignment, you will work with a large database of all the commercial, passenger, domestic flights flying in and out of Philadelphia in a year (the data is from 2008).

The data is provided in a file called, 2008PHL.csv. In it, each line has information about a single flight as shown below:

2008,3,26,700,913,WN,829,-7,-5,JAX,PHL,742,0
2008,3,26,1047,1817,WN,128,-8,7,LAS,PHL,2176,0
2008,3,26,1721,37,WN,1256,-18,11,LAS,PHL,2176,0
2008,3,26,1834,2053,WN,67,3,19,MCO,PHL,861,0

Each line has exactly thirteen (13) items or fields in the following order:
Year - year of flight
Month - month
Day - day of flight
Departure Time – scheduled time of departure (24-hour clock)
Arrival Time – scheduled arrival time (local time at destination, 24-hour clock)
Carrier – airline carrier code (IATA code)
Flight Number – a four-digit number
Arrival Delay – How late the flight arrived at destination (in minutes)
Departure Delay – how late the flight departed from its origin (in minutes)
Origin – 2-letter code for airport of origin
Destination – 3-letter code for destination airport
Distance – distance from origin to destination (in miles)
Cancelled – whether flight was cancelled (=1), or not (=0)

In the data provided above, the third entry then is about a flight on March 26, 2018, flight WN (Southwest Airlines) #1256 from LAS (Las Vegas) to PHL (Philadelphia). Its scheduled departure time was 5:21p (1721) and arrival time was 12:37a (37). The flight left LAS 18 minutes early and arrived in PHL 11 minutes late after traveling a distance of 2176 miles. This flight was not cancelled.

The data file’s location is: ~dkumar/CMSC246/A7/2008PHL.csv

Please do not copy this file since it is quite large (~10MB). Using the path provided you will be able to read the file from its original location.

Task#1: Getting Started

Two main data structures will be defined to model the data: Date & Flight. An initial set of functions is also provided to get you started. A starter program is provided in the files shown below:
~dkumar/CMSC246/A7/date.h     - The header file for Date
~dkumar/CMSC246/A7/date.c     - Source file for Date
~dkumar/CMSC246/A7/flight.h   - The header file for Flight
~dkumar/CMSC246/A7/flight.c   - Source file for Flight
~dkumar/CMSC246/A7/a7.c       - The main program
Create a directory called A7 in your account and copy the above files into it. Here is a short command you can use (say, you have created the A7 directory and are in it):

[Xena@CodeWarrior]$ cp ~dkumar/CMSC246/A7/*.h .
[Xena@CodeWarrior]$ cp ~dkumar/CMSC246/A7/*.c .

Go ahead and make sure you have copied these files. Print them out, and study the files provided before proceeding. Make sure you understand every line of the program.

Task#2: Compiling & Running

As we have learned in class and in lab, create a new make file to compile the program. Create an executable using your make file. Run the program to see what it does. Use the command:

./a7 ~dkumar/CMSC246/A7/2008PHL.csv

Its output should match your understanding of the program. If not, consult the TA or your instructor.

Task#3: Extending the Program

In this part you will write the following functions, as described below:

What to hand in:

Back to CMSC246 Home page