Ask Question
6 January, 13:04

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. 6 January, 14:52
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers