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 T 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 driver's license is suspended driver's license is 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.bt X OA. C:\Windows\system32\cmd.exe 123A 120 40 PNO Speed Type Tickets 27652K 200 90 123A 27652K 133.333 T 8725D 7625S 180 50 suspended 20 3653S T 145 240 50 suspended 100 т 8725D S 60 15 Total suspensions : 2 Press any key to continue 7252F S -80 15 7625S 100 60

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
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
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 Violation fee
S
Speed
Between 120 and 140 km/hour
10 OMR
20 OMR
Between 140 and 160 km/hour
30 OMR
60 OMR
50 OMR and
100 OMR and
driver's license is
More than 16Okm/hour
driver's license is suspended
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
C. C:\Windows\system32\cmd.exe
123A
S
120 40
PNO
Speed Type Tickets
27652K
T
200 90
123A
27652K
180
50
suspended
133.333 T
20
3653S
T
145
8725D
240
50
suspended
8725D
60 15
7625S
100
T
Total suspensions : 2
Press any key to continue
7252F
S
-80 15
7625S
100 60
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 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 Violation fee S Speed Between 120 and 140 km/hour 10 OMR 20 OMR Between 140 and 160 km/hour 30 OMR 60 OMR 50 OMR and 100 OMR and driver's license is More than 16Okm/hour driver's license is suspended 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 C. C:\Windows\system32\cmd.exe 123A S 120 40 PNO Speed Type Tickets 27652K T 200 90 123A 27652K 180 50 suspended 133.333 T 20 3653S T 145 8725D 240 50 suspended 8725D 60 15 7625S 100 T Total suspensions : 2 Press any key to continue 7252F S -80 15 7625S 100 60
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education