Question: Please complete the following program in C coding language ( NOT C + + ) , instructions are attached. In the end, two files must
Please complete the following program in C coding language NOT C instructions are attached. In the end, two files must be submitted, "airport.c and "airportReport.c
Here is the given code for "airport.h:
This is a collection of utility functions involving
and airport structure.
typedef struct
TODO: use your definition here
Airport;
A factory function to create a new Airport with the given
attributes. This function should make deep copies of each
of the relevant fields and return a pointer to the newly
created Airport structure.
Airport createAirportconst char gpsId,
const char type,
const char name,
double latitude,
double longitude,
int elevationFeet,
const char city,
const char countryAbbrv;
This function initializes an existing allocated
Airport structure with the given attributes.
void initAirportAirport airport,
const char gpsId,
const char type,
const char name,
double latitude,
double longitude,
int elevationFeet,
const char city,
const char countryAbbrv;
Constructs a new string representation of the given
Airport structure.
char airportToStringconst Airport a;
Prints all the airports in the given array of n
Airports.
void printAirportsAirport airports int n;
cmputes the air distance, in kilometers, between
the two Airports using their latitudelongitude
double getAirDistanceconst Airport origin, const Airport destination;
cmputes the estimated travel time in hours for a flight
that involves the given stops using the average flight speed
kilometers per hour and average layover time in hours
double getEstimatedTravelTimeconst Airport stops,
int size,
double aveKmsPerHour,
double aveLayoverTimeHrs;
A comparator function that orders the two Airport structures by
their GPS IDs in lexicographic order.
int cmpByGPSIdconst void a const void b;
A comparator function that orders the two Airport structures by
their type.
int cmpByTypeconst void a const void b;
A comparator function that orders the two Airport structures by
their name in lexicographic order.
int cmpByNameconst void a const void b;
A comparator function that orders the two Airport structures by
their name in reverse lexicographic order.
int cmpByNameDescconst void a const void b;
A comparator function that orders the two Airport structures first by
country, then by city
int cmpByCountryCityconst void a const void b;
A comparator function that orders the given Airport structures
by their latitudes north to south
int cmpByLatitudeconst void a const void b;
A comparator function that orders the given Airport structures
by their longitudes west to east
int cmpByLongitudeconst void a const void b;
A comparator function that orders the two Airport structures by
their relative distance from Lincoln Municipal Airport
R
in ascending order according closest to Lincoln would come first
int cmpByLincolnDistanceconst void a const void b;
A function that generates and prints several reports on the
given array of Airport structures.
void generateReportsAirport airports int n;
The given code for "airport.c which needs to be completed with the implementations of the functions in "airport.h is attached in separate screenshots. Thanks so much!
#include
#include "airport.h
vold generateReportssirport: aimports Int n
printfAinports original:
;
printAirportsainports; n;
printf
alenponts By GPS ID:
;
printf
Airportis By Type:
;
printf
Airponts:By Rame Revensed:
;
printf
Airponts By CountryCity:
;
printf
alirponts By latitudes
;
printf
airports : y Longitude:
;
printf
Airporits By bistance from Lincoln:
;
printf
closest Alrport to Lincoln:
;
printf
furshest kirpore from Lincoln:
;
printflnEastWest Geographic Center:
;
printf
Nlew York; IN airports:
;
lif none founds print: Wo ticg Mork aileport, found ling"
printf
targe girport:
;
retunn;
chan airportToStringcolist Airport a
char itemp:
f to four thefIntlion of gour Almport structure;
sprintftemp; Ks s zf f d s agpsId, atype; aname;
alatitude, alongitude, aelev
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
