Airline reservation system
Due: 24 Jan 2008
Educational objectives: Review C++ material that you have learned, such as implementing classes, using templates, I/O, etc. Use of STL classes (which you will learn in Lecture 3) and algorithms. Use of makefiles. Use of a debugger. Use of optimization flags with
gcc
.Statement of work: Develop a software that uses the STL (linked)
list
class to implement a simple airline reservation system, as described below. You may use any classes or algorithms provided by the STL.Deliverables: Turn in a
makefile
and all header (*.h) and cpp (*.cpp) files that are needed to build your software. Turn in your development log too, which should be a plain ASCII text file calledLOG.txt
in your project directory. You will submit all of these as described in www.cs.fsu.edu/~asriniva/courses/DS08/HWinstructions.html.Requirements:
- Create a subdirectory called
proj1
.- You will need to have a
makefile
in this directory. In addition, all the header and cpp files needed to build your software must be present here, as well as theLOG.txt
file.- You should implement appropriate classes for the software. Your code should be well designed and object oriented.
- Your software keeps track of reservation records. Each record consists of the following fields: (i) Name, (ii) Phone number, (iii) Flight number, and (iv) Date of travel. The user will enter Name in the following format:
FirstName space [middle initials, if applicable, with a period after each initial] space LastName
.The user will enter Phone number as a sequence of digits, with possibly, spaces, hyphens, and parentheses. All these, except the digits, should be ignored. That is, the number850-644-1234
is equivalent to the number(850) 644 1234
. The user will enter the flight number as a sequence of alphanumeric characters, without whitespace between them. The user will enter the travel date in one of the following forms:mmddyyyy
ormmddyy
. All user input can be considered to be syntactically correct. The user is provided the ability to perform the operations given below.- The software is run by the user on the command line, as follows:
- Reservations Filename
- The software reads a list of flights and the number of seats in them from
Filename
(which contains a flight number followed by the number of seats, on each line), and then repeats the following:
- It presents a prompt of the following form: Reservations>>
- It accepts commands typed by the user (each command is terminated by a newline). Any leading whitespace (before the command) is ignored.
- It performs an operation, as desired by the user's command. This operation may include an output. All output should be on a new line, and should terminate with a single newline character. You should not output anything other than those specified below.
- The complete set of commands accepted by your program are as follows.
new flight <flight-number> <seats>
- where <flight-number> is the flight number of a new flight to be added, and <seats> is the number of seats in that flight. If a flight with that name already exists, then you should output the following: A flight numbered <number> already exists. Flight not created.
quit
- This causes the program to terminate after de-allocating all memory that was allocated.
add (<name>, <phone-number>, <flight-number>, <date>)
- This creates a new reservation record if a seat is available. If an identical record exists, then you should output: This reservation already exists. Otherwise, if a seat is not available, then you should output: No seat available. If there is no flight numbered <flight-number>, then output: No flight numbered <flight-number> exists.
delete <name> from <flight-number> on <date>
- Delete the corresponding record. If the record does not exit, then output: This reservation does not exist.
is <name> in <flight-number> on <date>?
- Output Yes if <name> has a reservation on the specified flight. Otherwise output No.
lookup <name>
- Lists all records for <name> in the following format: 1. (<name1>, <phone-number1>, <flight-number1>, <date1>), 2. (<name2>, <phone-number2>, <flight-number2>, <date2>), ... . If a reservation with that name does not exist, then you should output: No reservation exists for <name>.
display <flight-number> on <date>
- Display each record in the specified flight, in the following format: 1. (<name1>, <phone-number1>, <flight-number1>, <date1>), 2. (<name2>, <phone-number2>, <flight-number2>, <date2>), ... . If no record exists for that flight, then output: No reservation exists for this flight. If there is no flight numbered <flight-number>, then output: No flight numbered <flight-number> exists.
Sample file and executable: A sample executable is available at proj1, which will run on
linprog
. It runs correctly for the sample input file FLIGHTS, with the sample commands given in input1. The first person to find errors in our program will get a bonus point!Bonus points (5):
You may get up to 5 additional points for significant extra work, such as implementing more features, or providing a GUI interface. Please obtain feedback from us prior to doing this. If you wish to get bonus points, then please submit your work as usual, but send an email to the TA. The TA will schedule a meeting with you, and you can demonstrate the special features of your software then.
Last modified: 10 Jan 2008