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
Ihjpr2 ywjegnak'evsinawhe2'qwmasnh ngl,;snhy
WITCHER [35]

Answer:

ummm ok?

Explanation:

6 0
3 years ago
Read 2 more answers
The pressure gauge on a tank of CO2 used to fill Dora-water bottles reads 51.0 psi.
tensa zangetsu [6.8K]

Known :

Pg = 51 psi

Patm = 28 inHg = 13.7 psi

Solution :

Absolute pressure is gauge pressure plus the atmospheric pressure :

Pabs = Pg + Patm

Pabs = 51 + 13.7

Pabs = 64.8 psi

3 0
2 years ago
A. Calculate the fraction of atom sites that are vacant for lead at its melting temperature of 327°C (600 K). Assume an energy f
NISA [10]

Answer:

a. Fraction of Atom = 2.41E-5 when T = 600K

b. Fraction of Atom = 5.03E-10 when T = 298K

Explanation:

a.

Given

T = Temperature = 600K

Qv = Energy for formation = 0.55eV/atom

To calculate the fraction of atom sites, we make use of the following formula

Nv/N = exp(-Qv/kT)

Where k = Boltzmann Constant = 8.62E-5eV/K

Nv/N = exp(-0.55/(8.62E-5 * 600))

Nv/N = 0.000024078672493307

Nv/N = 2.41E-5

b. When T = 298K

Nv/N = exp(-0.55/(8.62E-5 * 298))

Nv/N = 5.026591237904E−10

Nv/N = 5.03E-10 ----- Approximated

6 0
3 years ago
A displacement field in the +ve x direction is given as u=3x^2+14y^2-8xy. Determine the strains in the x and y directions.
Misha Larkins [42]

Answer:

Given

u_{x}(x,y)=3x^{2}+14y^{2}-8xy

The normal strain in x -direction is defined as

\epsilon _{xx}=\frac{\partial u_{x}}{\partial x}=\frac{\partial }{\partial x}(3x^{2}+14y^{2}-8xy)\\\\\therefore \epsilon _{xx}=6x-8y

Similarly the normal strain in y-direction is defined as

\epsilon _{yy}=\frac{\partial u_{y}}{\partial y}

Now since there is no displacement field along y direction thus we have

\epsilon _{yy}=0

Similarly shear strain in xy plane is given by

\epsilon _{xy}=\frac{1}{2}(\frac{\partial u_{x}}{\partial y}+\frac{\partial u_{y}}{\partial x})\\\\\therefore \epsilon _{xy}=\frac{1}{2}(\frac{\partial }{\partial y}(3x^{2}+14y^{2}-8xy)+\frac{\partial 0}{\partial x})\\\\\epsilon _{xy}=\frac{1}{2}(28y-8x)

3 0
3 years ago
Air, modeled as an ideal gas, is compressed at steady state from 1 bar, 300 K, to 5 bar, 500 K, with 170 kW of power input. Heat
Rina8888 [55]

Answer:

\dot m = 0.726\,\frac{kg}{s}

Explanation:

The process made by the compressor at steady-state is modelled after the First Principle of Thermodynamics:

-\dot Q_{out} + \dot W_{in} + \dot m \cdot (h_{in} - h_{out}) = 0

The mass flow rate is:

\dot m = \frac{\dot Q_{out}-\dot W_{in}}{h_{in}-h_{out}}

For ideal gases, specific enthalpies depends on temperature only. Properties at inlet and outlet are, respectively:

h_{in} = 300.19\,\frac{kJ}{kg}

h_{out} = 503.02\,\frac{kJ}{kg}

The mass flow rate of air is:

\dot m = \frac{22.67\,kW-170\,kW}{300.19\,\frac{kJ}{kg}-503.02\,\frac{kJ}{kg} }

\dot m = 0.726\,\frac{kg}{s}

8 0
3 years ago
Other questions:
  • why is the thermal conductivity of super insolation order of magnitude lower than the thermal conductivity of ordinary insulatio
    13·1 answer
  • Discuss the differences between conduction and convective heat transfer.
    12·1 answer
  • An inverting amplifier with +11 V supply voltages normally has a sinusoidal output of 10 Vpp. When checking the circuit with an
    11·1 answer
  • Why do engineers (and others) use the design process?
    13·1 answer
  • A tension test is carried out on an Al alloy specimen which has an original diameter of 0.505 in and an original gauge length of
    15·1 answer
  • Consider the following signal:
    8·1 answer
  • A person is planning a bungee jump from a 40 meter high bridge. Under the bridge is a river with crocodiles, so the person does
    7·1 answer
  • El tiempo hasta que falle un sistema informático sigue una distribución Exponencial con media de 600hs. (Utilice 3 decimales par
    13·1 answer
  • Air enters a compressor operating at steady state at 1.05 bar, 300 K, with a volumetric flow rate of 21 m3/min and exits at 12 b
    11·1 answer
  • While reflecting on the solutions and the process of concept generation, the development team takes a look at some critical ques
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!