Skip to content

3c help me… Suppose that you can only use addition, subtra

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!        

3c help me… Suppose that you can only use addition, subtraction,… 3c help me…Suppose that you can only use addition, subtraction, multiplication. division, rounding and integer powers of numbers. You decide to use a truncated Taylor Series to evaluate y = e with only these operations.(a) Create a function that approximates e by truncating the series to n terms. Use your function for n = 12 to approximate e for some values of r between -100 and 100. Repeat for n 50. Comment on your results.(b) By exploiting properties of the exponential, design an algorithm for accurately computing the value of e using your truncated series for r values between -100 and 100. Explain your algorithm and implement it. Report your relative error for e for r= 10.5 and +100 and compare to the previous part. You should be able to acheive relative errors below 10-13. Hint: Based on the Taylor Series remainder, for what values of a do you expect the series to be the most accurate? Exploit properties of the exponential to make an algorithm that only uses the series on this range of values.Image transcription textAppendix of Visualization In modelling and simulation orother scientific researches, visualization is a useful tool toeffectively show and analyze the results. So. in … Show more… Show moreImage transcription textProblem 1: C++ Linked List Library (cpplist) Your job is nowto refactor your C code from the second assignment andproduce a much more flexible library with sim… Show more… Show moreImage transcription text. Why don’t we include the headers apply .h and reduce .hhere? You’ll find those two other header files containingdefinitions for your ApplyFunction and Reduce… Show more… Show moreImage transcription textInput/Output Format Not applicable; your library will becompiled into a testing suite, your implemented functions willbe called by the program, and the behavior che… Show more… Show moreImage transcription textExercise 1 1.1 You are asked to generate a list of all persons whodo not have a middle name on file. Please query the Person.Person table for all persons with no middle name sto… Show more… Show moreData SetThe 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.Computer ScienceEngineering & TechnologyMYSQL COMPUTER A CSC424

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