Skip to content

EngineeringThe data set (attached) is a modified CSV file on

Do you have a similar question? Our professional writers have done a similar paper in past. Give Us your instructions and wait for a professional assignment!        

EngineeringThe data set (attached) is a modified CSV file on all International flight departing from US Airports between January and June 2019 reported by the US Department of Transportation (https://data.transportation.gov/Aviation/International_Report_Passengers/xgub-n9bw). Each record holds a route (origin to destination) operated by an airline. This CSV file was modified to keep it simple and relatively smaller. Here is a description of each column:Column 1 – Month (1 – January, 2 – February, 3 – March, 4 – April, 5 – May, 6 – June)Column 2 – 3-letter IATA Airport Code for the origin airport (e.g., SAT for San Antonio International Airport)Column 3 – 3-letter IATA Airport Code for the destination airportColumn 4 – 2-letter IATA Airline Code for the airline (e.g., AA for American Airlines). Some airlines will have a 3-letter airline code, your program will exclude them from the parsing.Column 5 – The passenger category, in our example, there is only one category.Column 6 – Total number of passengers in that month for that routeNote that there is a header row you must skip. Since this data holds passenger statistics for each route operated by an airline for six months, you should see the airline route repeated six times. For example, you will see the JFK to LHR operated by BA route 6 times, once for each of the six months.Task 1 – create route-records.hAll data is loaded into an array of RouteRecord’s which will they be queried in main().Create a struct named RouteRecord that will hold information about a route that is operated by one airline. The struct will have the following data members:Origin airport codeDestination airport codeAirline codeArray of passenger counts. There are six months’ worth of data for each route. (Index 0 will represent January’s passenger count, Index 1 will represent February’s passenger count, etc.).Add the header guards and prototypes for the functions (see Task 2)Include this enum in your header file so you can use as values for determining what type of search you will conduct.typedef enum SearchType { ROUTE, ORIGIN, DESTINATION, AIRLINE } SearchType;Task 2 – create route-records.cWrite the following functions:RouteRecord* createRecords( FILE* fileIn ) – This function creates the array of RouteRecord’s and initializes it. The function takes in a file pointer. The function will do the following:This function goes through the CSV file and counts the number of total records (not including the header)Dynamically allocate memory for an array of RouteRecord’s based on the count.Each RouteRecord struct object has an array of 6 integers to hold the number of passengers for six months. Initialize each of these integer values to 0. You do not need to initialize the other data members in the struct.Rewind the file pointerReturn the pointer to the array you dynamically allocated.int fillRecords( RouteRecord* r, FILE* fileIn ) – This function will process the data in the CSV file. Essentially, the code will go through each record, parse out the record, and enter it into the array. The function will follow these rules:If the record contains an airline that has 3 letters, ignore this record and go to the next record.The function will call findAirlineRoute() to see if the exact route with the origin, destination, and airline was already entered in the array. If it was found, then you will update the existing record in your array with the passenger data for that month. Recall there should be six entries (one for each month) for each route operated by an airline. If the route operated by the airline does not already exist in the array, add this new route to the array.The function returns the actual number of RouteRecord’s used in the array. The value returned will be less than the size of the array created since not all records in the original CSV file will be entered into the array.int findAirlineRoute( RouteRecord* r, int length, const char* origin, const char* destination, const char* airline, int curIdx ) – This RECURSIVE function finds a record in the RouteRecord array with the same origin and destination airport codes and airline. It returns the index number in which these three strings appear in the array. The function will return -1 if it cannot find these three strings in the same struct object.void searchRecords( RouteRecord* r, int length, const char* key1, const char* key2, SearchType st ) – This function searches the RouteRecord array and prints out the results of the search.You will traverse the array and compare specific data members against the keys.The parameter st determines if the function is searching by ROUTE, ORIGIN, DESTINATION, AIRLINE.For ORIGIN, DESTINATION, AIRLINE, key1 will hold the value you are looking for. For ROUTE, you are searching both the origin and destination and airport, so key1 and key2 will hold those values, respectively, that you will use to compare against the data members. For example, if the search is by the destination: st will be equal to DESTINATION, key1 will have an airport code that the user entered, and you will compare each struct’s destination data member against the airport code.You will print out the airline and the route for each matching value. Then, you will print out the total number of passengers on all matching records, total number of passengers by month for all matching records, as well as average numbers of passengers per month. Note that you must handle any instances where you the search has 0 results.void printRecords( RouteRecord* r, int length) – This function prints the records. rdenotes the pointer for the records and length is the number of records to be printed. You can also create another helper function that just prints one record – void printRecord( RouteRecord r ). The printRecords function can call the printRecord function to print one record at a time.void printMenu() – This function prints the menu. Here is the function below. Be sure to add this prototype to the header file.void printMenu(){printf( “nn######### Airline Route Records Database MENU #########n” );printf( “1. Search by Routen” );printf( “2. Search by Origin Airportn” );printf( “3. Search by Destination Airportn” );printf( “4. Search by Airlinen” );printf( “5. Quitn” );printf( “Enter your selection: ” );}TASK 3: Complete the project2-main.cDownload the attached project2-main.cFollow the instructions written in the comments in the main() function.The main() is the driver of the program. It calls the functions above to load the data from the CSV file and to run queries that the user asks for.The name of the file will be passed in through command line arguments.The user will enter a numeric value from the menu. You must handle the case in which the user enters invalid values (e.g., strings).Task 4: Create a makefileCreate a makefile to compile and link all the files together. The grader will compile your code using your makefile.Image transcription textQuestion 1 a] This year. the third waveof COMB?9 pandemic has changedhowI the Constmction Ind… Show more… Show moreImage transcription textFor Beam B) below, P = 2 kips Mo = 5 kip-ft L = 5 feet Using oursign convention, how does the internal bending moment varygoing from A to B? lob No. Sheet of Rev. Oregon Stat… Show more… Show moreImage transcription textDraw the network as AON; Find theCritical Path and duration, FS, TS.Draw the Gantt Chart for … Show more… Show moreEngineering & TechnologyCivil Engineering

Get a plagiarism-free order today   we guarantee confidentiality and a professional paper and we will meet the deadline.    

Leave a Reply

Order a plagiarism free paper today. Get 20% off your first order!

X