The Dutch government wants to track where every car in the Netherlands is by equipping each car with a short-range transmitter. When a car passes detectors that have been installed in the road surface, the transmitter sends the license plate number (kenteken) to these detectors. All detectors are connected to a central computer, that stores these license plate numbers in a file, as well as the id of the detector that received the license plate number, and the time at which the license plate number was received.
This system can be used to detect which cars are going over the speed limit. To do so, a file with the following structure is used:
Example input (an actual input file can be found on Canvas):
50
1 09:00:00 OZ-15-ZU
2 09:00:04 WS-LP-74
1 09:00:07 97-YC-51
1 09:00:10 NV-71-PU
2 09:00:21 OZ-15-ZU
[...]
2 09:04:58 CN-70-OT
You can assume that the detectors are on a one-way road, and the distance between the two detectors is 200 meters. Write a program that does the following:
Note: It is possible that there are cars in between the two sensors at the moment that the mea- surement starts. These cars will only pass the second detector during the measurement. You don't have to check if these cars go over the speed limit.
Example output:
The following cars went over the speed limit:
GH-23-NN - 68 km/h
NV-71-PU - 56 km/h
CN-70-OT - 70 km/h
18-IP-VU - 59 km/h
The following cars are currently between the two sensors:
45-HH-97
OF-UZ-13
Tip: In order to calculate the average speed of a car, you need to be able to convert a "time string" (e.g. 09:00:00) to a number of seconds (00:00:00 would be 0 seconds, 03:02:01 would be 10921 seconds, etc.). By converting two time strings to a number of seconds, you can determine the difference in seconds between the two times. The difference in time and the difference in meters can be used to determine the speed in m/s, which can then be used to determine the speed in km/h (1 m/s = 3.6 km/h).
For extra points for this assignment, print the cars that went over the speed limit in order from fastest to slowest.
Example output:
The following cars went over the speed limit:
CN-70-OT - 70 km/h
GH-23-NN - 68 km/h
18-IP-VU - 59 km/h
NV-71-PU - 56 km/h
The following cars are currently between the two sensors:
45-HH-97
OF-UZ-13