Question: 1) Create an algorithm for a program that simulates a police radar gun. The algorithm should read an automobile speed (in km/h) and print the
1) Create an algorithm for a program that simulates a police radar gun. The algorithm should read an automobile speed (in km/h) and print the message Speeding if the speed exceeds 60kmh. The algorithm should then also calculate the appropriate fine. If the speed is 5 km/hr or less over this limit, only issue a warning. $80 for more than 5 and no more than 10 kmh above the limit, $150 for more than 10 but no more than 20kmh above the limit, $500 for more than 20kmh above the limit. You should give some thought as to the type of data you are working with before beginning to designed your solution.
2) Implement the program from question 1 into a C program. When developing your program pay particular attention to the use of constant values in your program. Identify what values for this problem should be constants and define them using the const keyword. Ideally you should find that you have very few actual numbers (called literal values) in your program apart from when defining constants. (The obvious exception to this is the use of zero to initialise variables etc.)
Run the program with your test data and fill in the remainder of the test table.
Having real difficulty, send help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
