1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
almond37 [142]
3 years ago
9

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.
Computers and Technology
1 answer:
MariettaO [177]3 years ago
3 0

Answer:

The c++ coding for this scenario is given below.

if( speed < 0 )

           reverseDrivers = reverseDrivers + 1;

   else if( speed >= 0 && speed < 1 )

           parkedDrivers = parkedDrivers + 1;

   else if( speed >= 1 && speed < 40 )

           slowDrivers = slowDrivers + 1;

   else if( speed >= 40 && speed < 65 )

          safeDrivers = safeDrivers + 1;

   else

     speeders = speeders + 1;

Explanation:

First, five integer variables are declared and initialized.

int reverseDrivers = 0, parkedDrivers = 0, slowDrivers = 0, safeDrivers = 0, speeders = 0;

All the above variables need to be incremented by 1 based on the given condition, hence, these should have some original value.

Another variable speed of data type integer is declared.

int speed;

The variable speed is initialized to any value. User input is not taken for speed since it is not mentioned in the question.

Based on the value of the variable speed, one of the five variables, declared in the beginning, is incremented by 1.

The c++ program to implement the above scenario is as follows.

#include <iostream>

using namespace std;

int main() {

   int reverseDrivers = 0, parkedDrivers = 0, slowDrivers = 0, safeDrivers = 0, speeders = 0;

   int speed = 34;

   

   if( speed < 0 )

   {

       reverseDrivers = reverseDrivers + 1;

       cout<<" reverseDrivers " <<endl;

   }

   else if( speed >= 0 && speed < 1 )

   {

       parkedDrivers = parkedDrivers + 1;

      cout<<" parkedDrivers "<<endl;

   }

   else if( speed >= 1 && speed < 40 )

   {

       slowDrivers = slowDrivers + 1;

      cout<<" slowDrivers "<<endl;

   }

   else if( speed >= 40 && speed < 65 )

   {

       safeDrivers = safeDrivers + 1;

       cout<<" safeDrivers "<<endl;

   }

   else

   {

       speeders = speeders + 1;

       cout<<" speeders "<<endl;

   }

return 0;

}

The program only outputs the variable which is incremented based on the value of the variable speed.

You might be interested in
Does speedtest report megabytes per second or megabits
Lesechka [4]

that could be both *shrugging*

7 0
3 years ago
With the technology scaling and process improvement, do you think that existing CMOS will be able to exist in future?
Korolek [52]
Regardless of improvements, CMOS technology is very likely to dominate the semiconductor industry and will continue to evolve in the near future. Even in the present day of advanced CMOS, older TTL, RTL, and RTL designs are still able to find their markets. We can however, nevertheless, conclude that a newer and better approach will displace majority of current semiconductors. 
8 0
3 years ago
Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the n
bearhunter [10]

Answer:

Fault-Tolerance

Explanation:

Fault tolerance refers to the ability of a system (computer, network, cloud cluster, etc.) to continue operating without interruption when one or more of its components fail.

5 0
4 years ago
Who invented the first mechanical computer? in what year was it invented?.
Elodia [21]

Answer:

The first mechanical computer was invented by Charles Babbage in 1822.

6 0
2 years ago
Daphne used to work in the city where she would take public transportation to work. However, she just took a new job in the subu
mr Goodwill [35]

Answer:

A need

Explanation:

Daphne has no choice but to get a car and a house immediately, she relocates. Anything that is a choice and gives you the desire to acquire it, but cannot, due to one reason or the other, is a want. A need, on the hand, is something that Daphne should have to survive. She will need a car and a house to stay alive and will obviously not do anything without them. A home and a car are physical needs that can be touched or measured while aspects like happiness and good health are subjective needs that we need as humans to survive.

4 0
3 years ago
Other questions:
  • What are some common characteristics of jobs in this career cluster? check all that apply
    10·2 answers
  • Write the getNumGoodReviews method, which returns the number of good reviews for a given product name. A review is considered go
    14·1 answer
  • Select all that apply. Given the following code fragment, which of the things shown below happen when the statement on line 8 ex
    13·1 answer
  • Create a class that acts as a doubly linked list node. it should contain all the required data fields, at least 1 constructor, a
    7·1 answer
  • Which of the following statements is not true? Group of answer choices
    9·1 answer
  • Publishers that participate in a display ad network _____ a) get paid each time an advertiser is charged by the ad network for d
    7·1 answer
  • Which type of device often controls IoT tasks?<br> Desktop<br> Laptop<br> Smartphone<br> Switch
    8·1 answer
  • HEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLPPPPPPPPPPPPPPPPPPPPPPPPPPP
    12·2 answers
  • PROGRAM LANGUAGE C
    5·1 answer
  • QUESTION 8
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!