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
Why is the reflection step in the engineering process the most important step?
Monica [59]
Reflection helps designers to learn from their experiences, to integrate and co-ordinate different aspects of a design situation, to judge the progress of the design process, to evaluate interactions with the design context, and to plan suitable future design activities.
6 0
2 years ago
Why is the back-work ratio much higher in the brayton cycle than in the rankine cycle?
zloy xaker [14]

The back-work ratio much higher in the Brayton cycle than in the Rankine cycle because a gas cycle is the Brayton cycle, while a steam cycle is the Rankine cycle. Particularly, the creation of water droplets will be a constraint on the steam turbine's efficiency. Since gas has a bigger specific volume than steam, the compressor will have to work harder while using gas.

<h3>What are modern Brayton engines?</h3>

Even originally Brayton exclusively produced piston engines, modern Brayton engines are virtually invariably of the turbine variety. Brayton engines are also gas turbines.

<h3>What is the ranking cycle?</h3>

A gas cycle is the Brayton cycle, while the Ranking cycle is a steam cycle. The production of water droplets will especially decrease the steam turbine's performance. Gas-powered compressors will have to do more work since gas's specific volume is greater than steam's.

Th

To know more about Rankine cycle, visit: brainly.com/question/13040242

#SPJ4

4 0
1 year ago
Your program will be a line editor. A line editor is an editor where all operations are performed by entering commands at the co
soldier1979 [14.2K]

Answer:

Java program given below

Explanation:

import java.util.*;

import java.io.*;

public class Lineeditor

{

private static Node head;

 

class Node

{

 int data;

 Node next;

 public Node()

 {data = 0; next = null;}

 public Node(int x, Node n)

 {data = x; next =n;}

}

 

public void Displaylist(Node q)

 {if (q != null)

       {  

        System.out.println(q.data);

         Displaylist(q.next);

       }

 }

 

public void Buildlist()

  {Node q = new Node(0,null);

       head = q;

       String oneLine;

       try{BufferedReader indata = new

                 BufferedReader(new InputStreamReader(System.in)); // read data from terminals

                       System.out.println("Please enter a command or a line of text: ");  

          oneLine = indata.readLine();   // always need the following two lines to read data

         head.data = Integer.parseInt(oneLine);

         for (int i=1; i<=head.data; i++)

         {System.out.println("Please enter another command or a new line of text:");

               oneLine = indata.readLine();

               int num = Integer.parseInt(oneLine);

               Node p = new Node(num,null);

               q.next = p;

               q = p;}

       }catch(Exception e)

       { System.out.println("Error --" + e.toString());}

 }

public static void main(String[] args)

{Lineeditor mylist = new Lineeditor();

 mylist.Buildlist();

 mylist.Displaylist(head);

}

}

7 0
3 years ago
List and briefly describe two modern's materials needs
Angelina_Jolie [31]

Answer:

Modern and smart materials for making the products are improved by developing new materials and find new uses for the existing. As, modern industrialization society is increased demand and quality of the product.

Two modern's materials are:

Carbon Fiber: As, carbon fiber is a strong material and it is light in weight. Designers used it because it is five times strong as steel and two times as stiff. Carbon fiber is basically made out of very thin strands of carbon.

Fiber Optics: It is a new technology as, it is used as transparent solid to transmitted light signals.

4 0
3 years ago
Most deformation occurs along plate boundaries because ________.
Svetlanka [38]
B) the plates are in constant motion and as a result the boundaries are where they interact
3 0
3 years ago
Other questions:
  • Which of the following does NOT describe product design.
    11·1 answer
  • . A constant current of 1 ampere is measured flowing into the positive reference terminal of a pair of leads whose voltage we’ll
    10·1 answer
  • (8 points) Consider casting a concrete driveway 40 feet long, 12 feet wide and 6 in. thick. The proportions of the mix by weight
    8·1 answer
  • Water flows through a tee in a horizontal pipe system. The velocity in the stem of the tee is 15 f t/s, and the diameter is 12 i
    10·1 answer
  • Using phasors, the value of 37 sin 50t + 30 cos(50t – 45°) is _________ cos(50t+(_____°)). Please report your answer so the magn
    5·1 answer
  • In the well-insulated trans-Alaska pipeline, the high viscosity of the oil and long distances cause significant pressure drops,
    12·1 answer
  • Always refill your gas tank well before
    6·1 answer
  • For the system in problem 4, suppose a main memory access requires 30ns, the page fault rate is .01%, it costs 12ms to access a
    14·1 answer
  • A water contains 50.40 mg/L as CaCO3 of carbon dioxide, 190.00 mg/L as CaCO3 of Ca2 and 55.00 mg/L as CaCO3 of Mg2 . All of the
    5·2 answers
  • What is photosynthesis​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!