Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ ! Question #1: Speed System Program (6 pts) In this question, you will write a program that determines the penalty of a driver
Using C++ !
Question #1: Speed System Program (6 pts) In this question, you will write a program that determines the penalty of a driver who is speeding on highway with the speed limit of 100km/h based on Ontario Courts. Your program should follow the following rules: Prompt the user to enter name, id and score and validates the information. The student name should be entered as "LastName, FirstName" (separated by comma). Please note the whole name should be saved in one string. The driver ID must have 7 digits. The driver's SPEED must greater than 0. If the user enter correct information, your program should display the fine based on the speed. When the fine is displayed, the output should be "FirstName LastName got SPEED. Based on the speed system, FirstName (ID) will pay X." Please note the calculation of X is based on the following rules: - A $2.50/km speeding fine for 1-19km/h over the speed limit. - A $3.75/km speeding fine for 20-29km/h over the speed limit. - A $6.00/km speeding fine for 30-49km/h over the speed limit. 50+ km/h over the speed limit comes with a court decided fine. Your program should be able to ask user for new input of driver's information for penalty until get the input Yes from the user. Display welcome & closing messages. Assignment #2 Comp 218/Winter 2021 Page 2 of 7 program must display the same information with the same format. User input at the keyboard is marked with a red circle. Welcome to Speed System Program! Please enter your name (Lastname, Firstname seperated by comma): Liu, Tom Please enter your ID without any spaces (7 digits): 9090901 Please enter your speed: 110 Tom Liu got 110. Based on the speed system, Tom (9090901) will pay $25 Exit the program? (enter Yes to exit): No Please enter your name (Lastname, Firstname seperated by comma): Hans, Lucy Please enter your ID without any spaces (7 digits): 2314512 Please enter your speed: 125 Lucy Hans got 125. Based on the speed system, Lucy (2314512) will pay $93.75 Exit the program? (enter Yes to exit): No Please enter your name (Lastname, Firstname seperated by comma): Thame, Lin Please enter your ID without any spaces (7 digits): 2345678 Please enter your speed: 90 Lin Thame got 90. Based on the speed system, you do not need to pay any fine!! Exit the program?(enter Yes to exit): Yes Thank you for using Speed System ProgramStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started