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
Explain the need for data structures when developing software.
Sergio [31]

Solution:

It is  important because, it has to do operation on so without, data structures and algorithms.

It performs these operation:  

 1)Take an input

2) Process it  

3) Give back the output.

The input can be in any form, for ex while searching for directions on google maps,  the starting point and the destination as input to google maps, while logging in to any social sites, We have to give our email and password as input and so on.

Similarly, in the third step, the computer application gives us output in some form or the other.

To make this process efficient, we need to optimize all the three steps.

4 0
3 years ago
You are troubleshooting a client connectivity problem on an Ethernet network. The client system has intermittent connectivity to
lutik1710 [3]

Answer:

<em><u>D. The UTP cable does not support transmission distances of 75 feet without signal regeneration.</u></em><em> </em>

<em> is the </em><em>most</em><em> </em><em>likely cause of the connectivity problem</em><em>.</em>

Explanation:

hope it will help you

7 0
3 years ago
Explain the five generations of computer
liubo4ka [24]

Answer:

1 First Generation

The period of first generation: 1946-1959. Vacuum tube based.

2 Second Generation

The period of second generation: 1959-1965. Transistor based.

3 Third Generation

The period of third generation: 1965-1971. Integrated Circuit based.

4 Fourth Generation

The period of fourth generation: 1971-1980. VLSI microprocessor based.

5 Fifth Generation

The period of fifth generation: 1980-onwards. ULSI microprocessor based.

5 0
3 years ago
Read 2 more answers
Which is an example,of an input devices? Choose the answer.
Alenkasestr [34]

Answer:

microphone

Explanation:

You have to plug in microphones, and if you plug it in, it is considered an input.

3 0
3 years ago
For developing a mis in your business organization, you intend to launch a new is department or team. how the is function will s
sergiy2304 [10]

The   function will support my business because it will help in decision making.

<h3>What is the importance of  Management Information System?</h3>

Management Information System can be described as the collection of Organized data  that can help the organization  in decision making.

Making a good decision , it will help the company to compete excellently with great profit.

Learn more about Management Information System on:

brainly.com/question/11768396

#SPJ1

6 0
2 years ago
Other questions:
  • 1. How do you answer questions that require you to draw inferences? (1 point)
    7·2 answers
  • What is the difference between a software package and integrated software
    7·1 answer
  • What type of hardward drive not require defragging??
    11·1 answer
  • What is the least number of bits you would need to borrow from the network portion of a Class B subnet mask to get at least 130
    10·1 answer
  • In Word, a red wavy underline indicates a/an
    15·1 answer
  • Important tools used in the _____ phase of the DMAIC process include a project charter, a description of customer requirements,
    10·1 answer
  • 1.) Explain one way the internet has impacted the way we behave.
    7·2 answers
  • Please help i have 15 mins
    5·1 answer
  • Rebbeca has finished with the research and outline portion of her slide presentation. Now, the next logical step is to begin wor
    11·1 answer
  • Out of all the social media tools available today, the best tool to start when beginning your social marketing efforts is which
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!