At the end of this problem you should submit to Laulima (please zip these files to work around the 5 file limit):
- a file named UHusername_uber_velocity_fastest_list.c
- a file named UHusername_uber_velocity_fastest_list.h
- a file named UHusername_uber_velocity_fastest_list_constants.h
- a file named UHusername_uber_velocity_fastest_list_helpers.c
- a file named UHusername_uber_velocity_fastest_list_helpers.h
example:
- zhaol_uber_velocity_fastest_list.c
- zhaol_uber_velocity_fastest_list.h
- zhaol_uber_velocity_fastest_list_constants.h
- zhaol_uber_velocity_fastest_list_helpers.c
- zhaol_uber_velocity_fastest_list_helpers.h
-
It will be beneficial for you to leave your previous lab work untouched by copying them to a new folder for this lab and modify only the files in the new folder
If you were not able to complete Uber Ride Count and Distance from the Lab 10, you can create a brand new program. The feature set between both lab assignments are independent, however, calculating velocity requires distance to be calculated as well. Just follow the download instructions from Lab 10 and coordinate with your lab instructor.
Update your Uber Ride Count and Distance program from Lab 10 to add the following features (or write a new program that does the following):
-
Calculate the velocity for each ride:
- you can calculate the velocity using the following method:
- $velocity = {displacement}/{end\_time - start\_time}$
- Report velocity as distance per hour
- When computing ${displacement}/{end\_time - start\_time}$, do so in hours
- Do NOT ignore the minutes and seconds data
- For example, if the time difference is 1 hour, 15 minutes and 12 seconds, then $end\_time - start\_time = 1.2533$ not 1
- Feel free to use the
sqrt
function from themath.h
library- How to use the
sqrt
: http://www.cplusplus.com/reference/cmath/sqrt/ - How to compile with the
math.h
library: http://stackoverflow.com/questions/4120592/c-programming-sqrt-function
- How to use the
- Or you can write your own
sqrt
function
- you can calculate the velocity using the following method:
-
Generate a list of velocities sorted with the fastest ride on top:
- output a list of ride IDs with their average velocity to a file called uber_fastest_list_output.txt
- the ride IDs their average velocity are sorted with the fastest ride on top
-