CMSC 223 Systems Programming
Fall 2023


Assignment#6
Due BEFORE START OF Class on Monday, November 13, 2023

  1. Airports!
    Write a program that, given a database of all US airports (see details as well as how to get the data file from Lab 7), enables a user to search for airports by their code. Here is a sample output from such a program (called search.c)

    [Xena@codewarrior] $ ./search code.txt
    Able to open file: code.txt
    Reading data...done [3376 airports!]

    Enter the three-letter code for an airport: PHL
    Success: PHL - Philadelphia Intl, Philadelphia PA (USA)
    Would you like to search again (Y/N)? Y

    Enter the three-letter code for an airport: LHR
    Unsuccessful: PHL is not a know airport.
    Would you like to search again (Y/N)? Y


    Enter the three-letter code for an airport: 06U
    Success: 06U - Jackpot/Hayden, Jackpot, NV (USA)
    Would you like to search again (Y/N)? N
    Goodbye!

    Above, underlined text is user input.

    You will make use of the following from this week's lab:
    1. File I/O (using FILE, fopen(), fclose())
    2. Command line arguments (see example above)
    3. Using strtok() to parse the CSV file.
    4. Your main data structure will be an array of airports (define a structure type Airport). Here are the limits you may use: No more than 4000 airports, no more than 5 letters in airport code and state name, no more than 50 letters in airport name, and no more than 30 letters in city and country name.
    5. You will perform a simple linear search to look for an airport.
    6. Use good design principles to design your program (think OOP design, but apply it to the design of this C program). Define the Airport type in a separate file (airport.c) and create a corresponding header file (airport.h). Include the airport.h file in your main program.
    7. Create a Make file for compiling the program (as described in class).

    Sample output: Once done, show your program's output for the following inputs: BMC, 172 (One Seven Two), 00M (Zero Zero Em), TCS, BUZ, 5A8, DAR, ZZV, 22M, PHL.

Outputs
Once done, you will need to show the sample runs of programs, as required. In order to record the runs, you can use the Linux command script. Or, copy and paste the outputs in your report.

What to hand in:

Create a single PDF document containing the following:

Back to CS 223 Home page