Problem 2 (25 points) Write a C program that does the following:
1. Reads in the contents of a text file \texttt{inputFile.txt}, shown below. Note that the first value in the file
gives the number of lines of data -- use this in reading the rest of the file.
2. Each line corresponds to one leg of a trip. The first item is a character that gives the direction of
travel, the second item is a floating point number that gives the distance traveled, the third item is a
integer that gives the time traveled, in minutes.
3. Read this data into an array of structs. Be sure to define the structs first, and then declare the array,
called \texttt{tripLeg[]} . Each line of the file will correspond to one element of the struct array. The
struct should have members: direction, distance, time, and speed.
4. Calculate the speed in miles per hour for each leg of the trip and store the value in the appropriate
struct member.
5. Then calculate the total distance traveled, the total time traveled, and the average speed for the entire
trip. Note that you will need variables for this quantities.
6. Finally, write the struct information, (direction, distance, time, and speed) to a new file --
\texttt{outputFile.txt}. Also, at the end of the file, write the total distance, total time, and average speed.
Include whatever other variables are needed to do the job.
Contents of inputFile.txt
6
E 22.4 32
N 17.6 28
E 31.0 50
N 44.9 71
W 10.2 15
S 4.7 8