# Solve it using files and functions Transcribed Image Text: A local Road Safety Department is tasked with monitoring and issuing speeding tickets for

Solve it using files and functions Transcribed Image Text: A local Road Safety Department is tasked with monitoring and issuing speeding tickets for
drivers who violate the 120 km/hr speed limit. Write a complete C++ program that reads the
plate number of a car (string), travelled distance of in km (as integer) and the elapsed time in
minutes (as integer) from a file called “driving.txt”. The program should compute the speed
(km/hr) of the car and issue violation ticket if the driver exceeds the speed limit. The program
must distinguish between private small vehicles (‘S’) and large commercial trucks (‘T’).
Your program should implement the following functions:
Speed: Function that gets the distance (km) and the time (minutes) as input and returns the speed
of the car in km/hr
Tickets: Void function that determine the speeding tickets of each car as per Table 1. The
function takes plate number of the car and the car speed as input and prints out the tickets value
and any warnings for the driver.
Table 1: Speed tickets and warning classes
Speed
Speed Violation fee
Between 120 and 140 km/hour
10 OMR
20 OMR
Between 140 and 160 km/hour
30 OMR
60 OMR
More than 160km/hour
50 OMR and
100 OMR and
suspended
Less than or equal 120 km/hour
Input: The input file “driving.txt” consists of several test cases. Each test case consists of plate
number(string), car type (char), distance in km (positive integer, >=0) and time in minuets (integer, >0 ).
Note: Your program should only process correct input data.
Output: For each test case, print one line containing the plate number, speed violation and warning (if
any). The last line of the output contains the total number of issued speed violations.
Sample Input file and output screen:
driving.txt X
A. C:\Windows\system32\cmd.exe
123A
120 40
PNO
Speed Type Tickets
27652K
T
200 90
123A
27652K 133.333 T
8725D
7625S
180
50
suspended
20
3653S
T
145
240
50
suspended
100
8725D
60 15
Total suspensions : 2
Press any key to continue
7252F
S
-80 15
7625S
100 60

-25-