Ask Question
12 February, 18:55

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.

+4
Answers (1)
  1. 12 February, 19:11
    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 & 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