Answer:
int reverseDrivers ,parkedDrivers ,slowDrivers, safeDrivers ,speeders;
int speed; // variable declaration
if(speed<0) // checking condition
reverseDrivers++; // increment the value by 1
else if (speed<1) // checking condition
parkedDrivers++;// increment the value by 1
else if (speed<40) // checking condition
slowDrivers++;// increment the value by 1
else if(speed<=65) // checking condition
safeDrivers ++;// increment the value by 1
else
speeders++;// increment the value by 1
Step-by-step explanation:
Following are the description of statement
- Declared a variable reverseDrivers ,parkedDrivers, slowDrivers ,safeDrivers speeders and speed of integer types. These variables increments its value by 1 according to the condition of the speed variable.
- Speed variable check the condition of speed.
- if(speed<0) it increment the value by 1 in the "reverseDrivers" variable.
- if (speed<1) it increment the value by 1 in the "parkedDrivers" variable.
- if (speed<40) it increment the value by 1 in the "slowDrivers" variable.
- if(speed<=65) it increment the value by 1 in the "safeDrivers " variable.
- if all the if block condition fails then control moves to the else block and increment the value by 1 in the "speeders " variable.