n number of miles per hours (mph) over the speed limit is at least 5 mph. Ticket prices are calculated as follow: base + fee * . The base is always $150 and the fee per mph over the speed limit i
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
THIS PROGRAM MUST BE WRITTEN IN C++!
Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least 5 mph. Ticket prices are calculated as follow: base + fee * <number of mph over the speed limit>. The base is always $150 and the fee per mph over the speed limit is varied according to number of mph over the speed limit. The fee per mph over the speed limit is $5 when number of mph over the speed limit is no more than 20 mph. However, the fee per mph over the speed limit is $10 when number of mph over the speed limit is between 20 mph and 50 mph. In addition, a ticket of $1000 is automatically given to vehicle when number of mph over the speed limit is more than 50 mph.
You can assume that valid data will be provided, and your program must allow the processing to be repeated until a sentinel value of “QUIT” is entered. It must display percent of ticketed vehicles and average ticket amount. Follow the user-interface as shown below including 2 digits after the decimal point. You must run the following test cases as one run.
[Provide some useful information about AHP program
including your name, version, and instructions, etc.]
Enter a license plate number --> ABC123<Enter>
Enter current vehicle’s speed --> 60<Enter>
Enter speed limit in the zone --> 55<Enter>
Vehicle travelled 5 miles over the speed limit.
A ticket of $175 is issued to ABC123.
Enter a license plate number --> 123XYZ<Enter>
Enter current vehicle’s speed --> 59<Enter>
Enter speed limit in the zone --> 55<Enter>
Vehicle travelled 4 miles under the speed limit.
No ticket is issued to 123XYZ.
Enter a license plate number --> FASTONE<Enter>
Enter current vehicle’s speed --> 80<Enter>
Enter speed limit in the zone --> 50<Enter>
Vehicle travelled 30 miles over the speed limit.
A ticket of $450 is issued to FASTONE.
Enter a license plate number --> QUIT<Enter>
Tickets were given to 2 out of 3 vehicles.
Percent of ticketed vehicles: 66.67%
Average ticket amount: 312.50
Thank you for using our AHP program.
Additional Requirements: You must utilize modules/functions in your program. There must be at least 4 modules/functions: program information, input data, calculation, and display results. DO NOT use global variables in your program. Start with the design by identifying the modules/functions, drawing the hierarchy chart, and coming up with the pseudocode for each module/function before attempting your code on the computer. Be sure the follow the user-interface as specified.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images