Ask Question

Speeding violation calculator design a program that calculates and displays the number of miles per hour over the speed limit that a speeding driver was doing. the program should ask for the speed limit and the driver's speed. validate the input as follows: l the speed limit should be at least 20, but not greater than 70. l the driver's speed should be at least the value entered for the speed limit (otherwise the driver was not speeding). once correct data has been entered, the program should calculate and display the number of miles per hour over the speed limit that the driver was doing.

+1
Answers (1)
  1. 10 September, 23:47
    0
    Module main ()

    Declare Integer speedLimit, speed, lowSpeed, highSpeed, overSpeed

    Set lowSpeed = 20

    Set highSpeed = 70

    Display "Enter the speed limit."

    Input speedLimit

    While speedLimit highSpeed

    Display "ERROR: the speed limit must be between, " lowSpeed,"and", highSpeed,"."

    Display "Enter the speed limit."

    Input speedLimit

    End While

    Display "Enter your speed."

    Input speed

    Call calcSpeed (speedLimit, speed)

    Display "You were going", overSpeed,"MPH over the speed limit."

    End Module

    Module calcSpeed (Integer Ref speedLimit, speed)

    Set overSpeed = speedLimit - speed

    End Module
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Speeding violation calculator design a program that calculates and displays the number of miles per hour over the speed limit that a ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers