$24
Delta Airlines maintain four schedule flights per day numbered 100,200,300,400. For each of these flight, they keep a list of passengers as an ordered linked list. The passenger has his/her first name, last name, address, phone number. The database for the airline can be viewed as follows:
The database is required to keep the passengers sorted by their last names in ascending order.
You are asked to write a C++ program that sets up and maintain the database by handling the following commands
ADD, DELETE, SEARCH, LIST, QUIT
Here are the further requirements for the application.
Create a subclass OrderedLinkedList.h which inherits from LinkedList.h
Override insert, delete and search functions in OrderedLinkedList. You are allowed to modify LinkedList.h if necessary.
Using the header files OrderedLinkedList.h and LinkedList.h, make sure the passengers are stored as an ordered linked list: sorted by ascending order using passenger’s last name
Write an application that reads the command from the user and performs the operation
if the user wants to ADD a new passenger, ask the user to input flight number and also passenger information. Then insert passenger into the appropriate location in the ordered linked list using passenger’s last name.
if the user wants to DELETE a passenger, ask the user to input flight number and also passenger last name. Then remove passenger from the linked list of that flight
if the user wants to SEARCH a passenger, ask the user to input passenger last name and first name. Then search the user in all flights. If found, print the passenger’s flight
number together with his/her info. Assume that first name and last name uniquely identifies the passenger.
if the user wants to LIST the passengers, ask the user to input flight number. Then print the flight number and the list of passengers sorted by their last names including all passenger’s info.
Make sure user enters valid input, otherwise prompt an error message
Any non-numeric input for flight number is invalid o Any numeric input for name and surname is invalid
o Any value other than 100, 200, 300 and 400 for flight number is invalid
There is no validity check required for address and phone!
A sample run:
***DELTA AITLINES ***
Please choose an operation:
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): A
Enter flight number: 100
Enter first name: MARY
Enter last name: SMITH
Enter address: 12345 NE 50th St Bellevue WA
Enter phone: +14255062396
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): A
Enter flight number: 100
Enter first name: FATMA
Enter last name: SERCE
Enter address: 12345 SE 48th St Issaquah WA
Enter phone: +14251234567
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): S
Enter last name: SMITH
Enter last name: MARY
Flight Number: 100
First name: MARY
Last name: SMITH
Address: 12345 NE 50th St Bellevue WA
Phone: +14255062396
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L
Enter flight number: 100
FATMA SERCE [12345 SE 48th St Issaquah WA] [ +14251234567] MARY SMITH [12345 NE 50th St Bellevue WA] [ +14255062396]
…
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): D
Enter flight number: 100
Enter last name: SMITH
Enter last name: MARY
The passenger is deleted.
A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): Q
Hint: How to implement inheritance and override functions in subclasses in C++?
Submission:
Please follow the following steps for each assignment:
Create a separate repository in GitHub, named airlinedb
Clone the repository to your local computer.
Modify the files and commit changes to complete your solution in your local repository.
Push/sync the changes up to GitHub.
To turn in the assignment, send the link for the repository as an email to your instructor (fatma.serce@..)