Ask Question
4 March, 00:09

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.

+2
Answers (1)
  1. 4 March, 03:40
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers