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
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
Related questions
Topic Video
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education