Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to create a sorted list (by flight number) of flights with the information provided by the Flights.txt file that is provided as

Your task is to create a sorted list (by flight number) of flights with the information provided by the Flights.txt file that is provided as part of this assignment. The flight data consists of: airlines, flight number, arrival time, and departure time. You must also prompt the user to see if there is a flight to be deleted, once you have them in your linked list. The user can select a flight number and you must delete that flight from the linked list, and reprint the list. Continue asking the user if they want to delete a flight until the user types in Q or q. Then exit the program.

1. The Flights.txt file name should be used as an argument to your program from the command line. Flights.txt should not be hard coded into your program. I will use a differently named text file to test your code. The file I use may also have a different number of flights.

2. You must read each line of the file, putting each flight into a structure, that is then used to create a linked list of flights

3. You are not allowed to use any arrays to store your data, only the linked list.

4. Your program should dynamically allocate memory using calls to calloc or malloc when creating a new structure for the linked list. Similarly, when a structure is deleted, it should also be freed with free()

5. You must keep the linked list in a sorted order so that as you read the flights, you can insert the new flight into the correct place in the linked list. Also, when you delete a flight, the list should still be in order.

6. Print each flight as you read it into your program, then print the final sorted list before ending your program.

7. Functions should be used to insert, print, and delete the flight structures.

You should use the following functions at a minimum Feel free to change these function prototypes to suit your program.

void Insert(struct Flight *f, struct Flight *head)

void Delete(struct Flight *f)

void PrintList(struct Flight *head

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions