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
Semenov [28]
3 years ago
9

Using a conditional expression, write a statement that increments num_users if update_direction is 3, otherwise decrements num_u

sers. Sample output with inputs: 8 3 New value is: 9
Engineering
1 answer:
yuradex [85]3 years ago
6 0

Answer:

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

Explanation:

A. Using the regular if..else statement, the response to the question would be like so;

if (update_direction == 3) {

  ++num_users;  // this will increment num_users by 1

}

else {

 -- num_users;    //this will decrement num_users by 1

}

Note: A conditional expression has the following format;

<em>testcondition ? true : false;</em>

where

a. <em>testcondition </em>is the condition to be tested for. In this case, if update_direction is 3 (update_direction == 3).

b. <em>true </em>is the statement to be executed if the <em>testcondition</em> is true.

c. false is the statement to be executed it the <em>testcondition</em> is false.

B. Converting the above code snippet (the if..else statement in A above) into a conditional expression statement we have;

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

<em>Hope this helps!</em>

You might be interested in
Technician A says that the definition of torque is how far the crankshaft twists in degrees.Technician B says that torque can re
leonid [27]
Technician B is correct because torque is a force of an object.
6 0
1 year ago
Water at 15°C is to be discharged from a reservoir at a rate of 18 L/s using two horizontal cast iron pipes connected in series
love history [14]

Answer:

The required pumping head is 1344.55 m and the pumping power is 236.96 kW

Explanation:

The energy equation is equal to:

\frac{P_{1} }{\gamma } +\frac{V_{1}^{2}  }{2g} +z_{1} =\frac{P_{2} }{\gamma } +\frac{V_{2}^{2}  }{2g} +z_{2}+h_{i} -h_{pump} , if V_{1} =0,z_{2} =0\\h_{pump} =\frac{V_{2}^{2}}{2} +h_{i}-z_{1}

For the pipe 1, the flow velocity is:

V_{1} =\frac{Q}{\frac{\pi D^{2} }{4} }

Q = 18 L/s = 0.018 m³/s

D = 6 cm = 0.06 m

V_{1} =\frac{0.018}{\frac{\pi *0.06^{2} }{4} } =6.366m/s

The Reynold´s number is:

Re=\frac{\rho *V*D}{u} =\frac{999.1*6.366*0.06}{1.138x10^{-3} } =335339.4

\frac{\epsilon }{D} =\frac{0.00026}{0.06} =0.0043

Using the graph of Moody, I will select the f value at 0.0043 and 335339.4, as 0.02941

The head of pipe 1 is:

h_{1} =\frac{V_{1}^{2}  }{2g} (k_{L}+\frac{fL}{D}  )=\frac{6.366^{2} }{2*9.8} *(0.5+\frac{0.0294*20}{0.06} )=21.3m

For the pipe 2, the flow velocity is:

V_{2} =\frac{0.018}{\frac{\pi *0.03^{2} }{4} } =25.46m/s

The Reynold´s number is:

Re=\frac{\rho *V*D}{u} =\frac{999.1*25.46*0.03}{1.138x10^{-3} } =670573.4

\frac{\epsilon }{D} =\frac{0.00026}{0.03} =0.0087

The head of pipe 1 is:

h_{2} =\frac{V_{2}^{2}  }{2g} (k_{L}+\frac{fL}{D}  )=\frac{25.46^{2} }{2*9.8} *(0.5+\frac{0.033*36}{0.03} )=1326.18m

The total head is:

hi = 1326.18 + 21.3 = 1347.48 m

The required pump head is:

h_{pump} =\frac{25.46^{2} }{2*9.8} +1347.48-36=1344.55m

The required pumping power is:

P=Q\rho *g*h_{pump}  =0.018*999.1*9.8*1344.55=236965.16W=236.96kW

8 0
3 years ago
What else will change, if you change the point of view
JulijaS [17]

Answer:

We would need background context,

Explanation:

Then I would be happy to help!

4 0
3 years ago
A gear train has two gears. The driver gear has 8 teeth and a diametral pitch of 6 teeth/inch. the follower gear has 24 teeth. W
Sliva [168]

Answer:

18 teeth/inch

Explanation:

Given that: i. driver gear has 8 teeth and diametral pitch of 6 teeth/inch.

                  ii. follower gear has 24 teeth.

Let the followers diametral pitch be represented by x.

Then,

8 teeth ⇒  6 teeth/inch

24 teeth ⇒ x teeth/inch

So that;

x = \frac{24 x 6}{8}

   = \frac{144}{8}

   = 18 teeth/inch

The diametral is 18 teeth/inch

3 0
3 years ago
A Pitot-static probe is used to measure the speed of an aircraft flying at 3000 m. If the differential pressure reading is 3200
coldgirl [10]

Answer:

Speed of aircraft ; (V_1) = 83.9 m/s

Explanation:

The height at which aircraft is flying = 3000 m

The differential pressure = 3200 N/m²

From the table i attached, the density of air at 3000 m altitude is; ρ = 0.909 kg/m3

Now, we will solve this question under the assumption that the air flow is steady, incompressible and irrotational with negligible frictional and wind effects.

Thus, let's apply the Bernoulli equation :

P1/ρg + (V_1)²/2g + z1 = P2/ρg + (V_2)²/2g + z2

Now, neglecting head difference due to high altitude i.e ( z1=z2 ) and V2 =0 at stagnation point.

We'll obtain ;

P1/ρg + (V_1)²/2g = P2/ρg

Let's make V_1 the subject;

(V_1)² = 2(P1 - P2)/ρ

(V_1) = √(2(P1 - P2)/ρ)

P1 - P2 is the differential pressure and has a value of 3200 N/m² from the question

Thus,

(V_1) = √(2 x 3200)/0.909)

(V_1) = 83.9 m/s

4 0
3 years ago
Other questions:
  • Which of the following describes fibers? a)- Single crystals with extremely large length-to-diameter ratios. b)- Polycrystalline
    10·1 answer
  • Please Help It's really Important
    12·1 answer
  • Block B starts from rest, block A moves with a constant acceleration, and slider block C moves to the right with a constant acce
    11·1 answer
  • The European Space Agency launched a probe called Rosetta in March 2004. In August​ 2014, Rosetta reached its​ destination: a co
    13·1 answer
  • A 3-m wide rectangular channel has a flow velocity of 1.8 m/s when the depth of flow is 1.2 m. what will be the flow velocity wh
    14·1 answer
  • What is the maximum value of the bending stress at the critical cross-section?
    14·1 answer
  • 1. Given: R= 25 , E = 100 V<br> Solve for I
    5·1 answer
  • Which of the following explains why trucking is the most widely used transportation method?
    14·1 answer
  • A blue and a yellow cubes are rolled- What is the probability that a yellow cube is a multiple of 3 and the product is 6?
    7·1 answer
  • A heating element for a cooking appliance is stretched too far during installation. What action can be performed? A. Dispose of
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!