This project may be done in pairs of students. We suggest that you sit together at the same computer and apply the pair programming technique. Take turns as the driver and navigator. (If you prefer to work alone, that is ok too.)
The objectives for this assignment are for you to:
mkdir cse20211/lab9 cd cse20211/lab9
A master list of all flights is listed in a file called flights.txt, which you should download and put in your lab directory. (This is fictional data I generated with a program, but you can download and play with real data from the Open Flights project.)
The travel agent program should begin by loading the entire list of flights into several arrays in memory. You will use these arrays throughout the program to display the available flights and decide what to do next.
Here are a few lines from the middle of the file:
.. SBN MSP 15:16 17:22 $229 SBN MSP 17:21 20:44 $137 SBN DEN 18:44 21:30 $213 ORD ATL 6:31 9:56 $373 ORD DTW 7:50 9:01 $205 ORD BOS 8:44 9:56 $105 ..Each line in the file describes the origin airport, the destination airport, the time of arrival and departure (on a 24-hour clock) and the cost of the flight. For example, the first line above indicates a flight departing South Bend at 15:16, arriving at Minneapolis on 17:22, and costing $229.
Your program should begin by asking the user what airport they are starting at. Then, display all the flights available for that day from that airport, allowing the user to pick one. Once a flight is selected, display the flights available from that airport. The user can type end to indicate the itinerary is complete, or cancel to cancel the previous flight.
When the itinerary is complete, open a file named itinerary.txt and write out a nicely formatted itinerary with the name of your travel agency, the list of the flights (arranged in labelled columns), and the detailed and total costs.
Hints to keep in mind:
travel: travel.c gcc travel.c -o travel clean: rm -f travel(Note that you must have a TAB at the beginning of the line that starts with gcc. If you put in spaces, it won't work.)
Each rule in a Makefile indicates how to build a part of your program. The first line of the Makefile indicates that travel depends on the source file travel.c. The second line of the Makefile indicates how to build travel, by giving the compile instruction. It is also customary to have a clean rule that explains how to remove whatever the Makefile created.
Once the Makefile exists, all you have to do is type make, which examines the Makefile and decides what to do. For very complex programs, a Makefile is an indispensable tool for managing the build process.
For this lab, you are required to use and turn in a Makefile.
Turn in travel.c, Makefile, and report.txt. Your lab report should cover the assignment, explaning how it works from the user perspective, how the program works internally, and how you verified that the output of the program is correct.
If you are working in pairs, turn in your assignment to either student's dropbox (not both) and clearly indicate the names of both students in your report. Both students will receive the same grade on the project.
This assignment is due on Monday, November 19th at noon Tuesday, November 19th at 5pm. Late assignments are not accepted.