erlang programming
ACO 240 Spring 2021 1 Erlang Programming Assignment Erlang Programming Assignment Due: Start of Class Friday, 9 April 2021 In this comprehensive programming assignment, you will combine the various components of the Erlang programming language that you learned this semester. The program processes data about airline flights provided in csv format, which is described later in this document. The program will process the CSV data by creating several maps, and then answering some questions about the data. Note that this is the same scenario as the Python programming assignment but with some changes to accommodate the Erlang programming language, which does not have objects. 1. The data will be stored as Erlang tuples with the numeric fields stored as numbers - not strings: • {airline, Airline_Code, Airline_Name, Flights_List} • {airport, Airport_Code, Airport_Name, City, State, Origin_Flights, Destination_Flights} • {flight, Date, Airline_Code, Flight_Num, Origin_Airport_Code, Dest_Airport_Code, Scheduled_Departure, Departure_Time, Departure_Delay, Scheduled_Arrival, Arrival_Time, Arrival_Delay} 2. The flight_info.csv file has changed: a. The three separate year, month, day fields have been combined into one date field in the format: yyyy-mm-dd b. The header row has been removed to simplify the file processing. The assignment consists of 3 tests. 1. [60] Process the CSV file by creating tuples as specified above, maintaining the following maps: (NOTE: You must process the csv only ONCE to create the maps.) • Airline_Map: associating the unique airline code to its associated airline tuple. airline code => airline tuple • Airport_Map: associating the unique airport code to its associated airport tuple. airport code => airport tuple • Date_Map: associating the unique date to a list of its associated flight tuples ordered by scheduled departure time. date => [ flight tuples ] OUTPUT: Note that the test code is displaying the following information – test case 1 airline tuples in alphabetical order by airline code with the number of flights airport tuples in alphabetical order by airport code with the number of origin and destination flights date: number of flights with the first and last flight tuples to verify that flights are ordered by scheduled departure 2. [20] Query 1: For each date in chronological order, which flight on that day had the longest arrival delay? Include duplicates, if any. OUTPUT: test case 2 yyyy-mm-dd: flight tuple of flight with longest arrival delay ACO 240 Spring 2021 2 Erlang Programming Assignment 3. [20] Query 2: For each airport in alphabetical order by airport code, find the number of origin flights with departure delays more than 15 minutes and the number of destination flights with arrival delays more than 15 minutes. OUTPUT: test case 3 airport tuple EXCEPT that instead of the list of origin and destination flights, replace with the length of the lists origin delays: # destination delays: # You must structure the code as follows on repl.it using the template provided for the assignment. Files: ● main.erl – This contains the processing of the csv files to create the tuples and maps. Note that the template given to you reads the CSV file, giving you a list of the data fields on a line to process. There is code at the end of the template that you cannot change for input/output testing. Note that you should not change the template code except for modifying the parameters to the recursive call to use the updated maps from processing the current line of the data file. ● flights_info.csv – Do NOT modify this file. This is the data file to use for the assignment. On the due date, you MUST do the following: 1. A signed PDF document that indicates the status of the implementation that you submitted for assessment along with a statement signed verifying that you followed the academic integrity policy. This document will be provided to you on the Canvas assignment description. Programs will not be assessed without this document that is completely filled out by indicating the test cases passed and signed by you that you followed the academic integrity policy. 2. You MUST submit the assignment on repl.it after running the test cases! This will indicate the number of tests passed, which will essentially determine your grade on the program. 3. A zip file downloaded from repl.it that contains all of the above files submitted in Canvas. NOTE: Canvas is the official record of your ASU work and essentially timestamps what you had working by the official deadline. REMINDER: THIS IS AN INDIVIDUAL ASSIGNMENT! Only programs that successfully execute will be considered for assessment. Incremental Development Suggestions: Work on the implementation of each test, saving a working version for each incorporated checkbox so that you can earn partial credit if you do not get ALL checkboxes implemented. ACO 240 Spring 2021 3 Erlang Programming Assignment Field Descriptions Key Type Comment Example Value Date String The date of the flight, specified as a string in the format: yyyy-mm-dd “2015-01-05” Airline String 2 letter International Air Transport Association (IATA) code to identify airline operating flight. "WN" Airline Name String Name of airline operating flight. "Southwest Airlines Co." Flight Number Integer Numeric code used to identify flight. Ranges from 2 to 4 digits. 4657 Origin Airport String 3 letter IATA code to identify the flight's starting airport. "RNO" Origin Name String Name of flight's origin airport. "Reno/Tahoe International Airport" Origin City String City of flight's origin airport. "Reno" Origin State String 2 letter abbreviation of US state of flight's origin airport. "NV" Destination Airport String 3 letter IATA code to identify flight's destination airport. "LAS" Destination Name String Name of flight's destination airport. "McCarran International Airport" Destination City String City of flight's destination airport. "Las Vegas" Destination State String 2 letter abbreviation of US state of flight's destination airport. "NV" Schedule Departure Integer Integer representation of the UTC time of a flight's planned departure from origin airport. Times can fall in the range of 0 – 2359. First two digits are the hour and the second two numbers are the digits. 555 Departure Time Integer Integer representation of the UTC time of a flight's actual departure from origin airport. 550 Departure Delay Integer Number of minutes between flight's planned departure and actual departure. Negative value means flight departed ahead of schedule, 0 means flight departed on time, positive means the flight departed late. -5 Scheduled Arrival Integer Integer representation of the UTC time of a flight's planned arrival at destination airport. 715 Arrival Time Integer Integer representation of the UTC time of a flight's actual arrival at destination airport. 707 Arrival Delay Integer Number of minutes between flight's planned arrival and actual arrival. Negative value means flight departed ahead of schedule, 0 means flight departed on time, positive means the flight departed late. -8