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
Given the code below, which three statements can be used to create the controller variable?
Black_prince [1.1K]

Answer:

B, D, E

Explanation:

B. Apexpages.standardsetcontroller controller=new

apexpages.standardsetcontroller(database.getquerylocator('select id from account'));

D. Apexpages.standardsetcontroller controller = new

apexpages.standardsetcontroller (database.getquerylocator([select id

from account])); and

E. Apexpages.standardsetcontroller controller = new

apexpages.standardsetcontroller (database.query('select id from

account'));

7 0
3 years ago
Open a command prompt on PC1. Issue the command to display the IPv6 settings. Based on the output, would you expect PC1 to be ab
Strike441 [17]

Answer:

yes it can communicate with all interfaces on the router.

Explanation:

PC1 has the right default gateway and is using the link-local address on R1. All connected networks are on the routing table.

Netsh may be a Windows command wont to display and modify the network configuration of a currently running local or remote computer. These activities will tell you in how manny ways we can use the netsh command to configure IPv6 settings.

To use this command :

1. Open prompt .

2. Use ipconfig to display IP address information. Observe the  output whether IPv6 is enabled, you ought to see one or more IPv6 addresses. A typical Windows 7 computer features a Link-local IPv6 Address, an ISATAP tunnel adapter with media disconnected, and a Teredo tunnel adapter. Link-local addresses begin with fe80::/10. ISATAP addresses are specific link-local addresses.  

3. Type netsh interface ipv6 show interfaces and press Enter. note the output listing the interfaces on which IPv6 is enabled. Note that each one netsh parameters could also be abbreviated, as long because the abbreviation may be a unique parameter. netsh interface ipv6 show interfaces could also be entered as netsh  ipv6 sh i.

4. Type netsh interface ipv6 show addresses  Observe the results  of the interface IPv6 addresses.

5. Type netsh interface ipv6 show destinationcache and press Enter. Observe the output of recent IPv6 destinations.

6. Type netsh interface ipv6 show dnsservers and press Enter. Observe the results listing IPv6 DNS server settings.

7. Type netsh interface ipv6 show neighbors and press Enter. Observe the results listing IPv6 neighbors. this is often almost like the IPv4 ARP cache.

8. Type netsh interface ipv6 show route and press Enter. Observe the results listing IPv6 route information.

5 0
3 years ago
What are three limitations of computer?​
Lady bird [3.3K]

Answer:

Explanation:

Three limittaions of computer are:

It requires reqular power supply to operate .

It needs instructions to perform a task.

It cannot memorize and recall.

8 0
3 years ago
Software piracy is acceptable as it helps us obtain software cheaper or sometimes even for free.
mr Goodwill [35]

Answer:

1: false because it's just scams

2: true

Explanation:

3 0
3 years ago
Dragging a mouse over text is called
Fantom [35]

Answer:

typing

Explanation:

8 0
3 years ago
Other questions:
  • Two electronics technicians are discussing electrical quantities. Technician A says that resistance is an opposition to electric
    6·1 answer
  • Please help!
    10·2 answers
  • Investigations involving the preservation, identification, extraction, documentation, and interpretation of computer media for e
    12·1 answer
  • Consider a router that interconnects three subnets: subnet 1, subnet 2, and subnet 3. suppose all of the interfaces in each of t
    11·2 answers
  • As an IT tech for your company, you have been notified that the Windows domain does not seem to be functioning properly. Being f
    7·1 answer
  • Adam has decided to add a table in a Word doc to organize the information better.
    10·1 answer
  • Explain 5 service provided by Internet​
    6·1 answer
  • Language/Type: Java ArrayList Collections
    6·1 answer
  • If you have an equipment failure while driving on an expressway, you should
    8·1 answer
  • Is Missouri a free state or a slave state​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!