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.
.
.
Click on the title for the solution
.
.
if (speed<0) reverseDrivers +=1;
else if (speed<1) parkedDrivers+=1;
else if (speed<40) slowDrivers +=1;
else if (speed<=65) safeDrivers +=1;
else speeders +=1;
.
Click on the title for the solution
.
.
This is the answer:
:
if (speed<0) reverseDrivers +=1;
else if (speed<1) parkedDrivers+=1;
else if (speed<40) slowDrivers +=1;
else if (speed<=65) safeDrivers +=1;
else speeders +=1;
Comments
Post a Comment