Ask Question
12 October, 13:14

c+ + Write a statement that increments (adds 1 to) one and only one of these five variables: reverseDrivers parkedDrivers slowDrivers safeDrivers speeders. The variable speed determines which of the five is incremented as follows: The statement increments reverseDrivers if speed is less than 0, increments parkedDrivers if speed is less than 1, increments slowDrivers if speed is less than 40, increments safeDrivers if speed is less than or equal to 65, and otherwise increments speeders.

+2
Answers (1)
  1. 12 October, 16:36
    0
    The following statement are:

    if (speed < 0) / / if statement

    {

    reverseDrivers++; / /if the speed is less than 0, then increment in "reverseDrivers"

    }

    else if (speed < 1) / /else if statement

    {

    parkedDrivers++; / /speed is less than 1, than increments in "parkedDrivers"

    }

    else if (speed < 40)

    {

    slowDrivers++; / /speed is less then 40, than increment in "slowDriver"

    }

    else if (speed < = 65)

    {

    safeDrivers++; / /speed is less than or equal to 40, then increment in "safeDriver"

    }

    else

    {

    speeders++; / /else increment in speeders

    }

    Explanation:

    From the following statement their are certain condition arises

    If the speed is less than 0, then increments the "reverseDrivers" variable by 1.

    If the speed is less than 1, then increments the "parkDriver" variable by 1.

    If speed is less than 40, then increment in "slowDriver" variable by 1.

    If speed is less than or equal to 40, then increment in "safeDriver" variable by 1.

    Otherwise increment in "speeders"
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “c+ + Write a statement that increments (adds 1 to) one and only one of these five variables: reverseDrivers parkedDrivers slowDrivers ...” 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