Ask Question
19 November, 13:42

Write a multi-way if/else statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0, adds 1 to the variable parkedDrivers if the variable speed is less than 1, adds 1 to the variable slowDrivers if the variable speed is less than 40, adds 1 to the variable safeDrivers if the variable speed is less than or equal to 65, and otherwise adds 1 to the variable speeders.

+3
Answers (1)
  1. 19 November, 15:02
    0
    Code in jа vascript.

    Preconditions:

    All the variables are defined and initialized.

    if (speed < 0) { / / if speed is < 0 then adds 1 to reverse drivers.

    reverseDrivers + +;

    } else if (speed < 1) { / / else if speed is < 1 then adds 1 to parked drivers.

    parkedDrivers + +;

    } else if (speed < 40) { / / else if speed is < 40 then adds 1 to slow drivers.

    slowDrivers + +;

    } else if (speed < = 65) { / / else if speed is < = 65 then adds 1 to safe drivers.

    slowDrivers + +;

    } else { / / else if speed is > 65 then adds 1 to speeders.

    speeders++;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a multi-way if/else statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0, adds 1 to the variable ...” 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