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
In-s [12.5K]
3 years ago
12

Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 then the outp

ut is: 8 3 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int* userVal1, int* userVal2)
Computers and Technology
1 answer:
Ainat [17]3 years ago
4 0

Answer:

public class num3 {

   public static String swapValues(int userVal1, int userVal2){

       int temp = userVal2;

       userVal2 = userVal1;

       userVal1 = temp;

       return(userVal1+", "+userVal2);

   }

   public static void main(String[] args) {

       int val1 = 5;

       int val2 = 8;

       System.out.println("Original values");

       System.out.println(val1+", "+val2);

       System.out.println("Swapped Values");

       System.out.println(swapValues(val1,val2));

   }

}

Explanation:

  • The problem is solved with Java programming language
  • Define the method swapValues() to accept two ints and return a String
  • Within the method body, create a temp variable to hold the value of userVal2 temporary
  • Do the following re-assignment of values userVal2 = userVal1; userVal1 = temp;
  • Return the concatenated String userVal1+", "+userVal2
  • Create two variables and initialize them in the main method
  • Output their values
  • Call swapValues() aand output the swapped values
You might be interested in
Derek is working at the help desk when he receives a call from a client about an issue with the company’s email. The customer is
never [62]

Answer:

Let the customer vent and then restart the conversation

Explanation:

It is best for Derek in this situation allow the customer say everything on his or her mind about the problems at hand. This will help Derek identify and understand the problems and fix them accordingly. However, he'd need to start the world all over again to achieve this.

Cheers

5 0
3 years ago
True or False?
Nadya [2.5K]

False.

The different between break and continue instruction is that with break you exit the loop, and with continue you skip to the next iteration.

So, for example, a loop like

for(i = 1; i <= 10; i++){

   if(i <= 5){

       print(i);

   } else {

       break;

   }

}

will print 1,2,3,4,5, because when i=6 you will enter the else branch and you will exit the loop because of the break instruction.

On the other hand, a loop like

for(i = 1; i <= 10; i++){

   if(i % 2 == 0){

       print(i);

   } else {

       continue;

   }

}

Will print 2,4,6,8,10, because if i is even you print it, and if i is odd you will simply skip to the next iteration.

6 0
3 years ago
Microsoft Word
ValentinkaMS [17]
It looks like it would have to be choice D.

Explanation: Pagination is number assignment to pages. Word wrap is when if a word is too long it is sent to the next line. Editing would not be a precise or accurate answer.
3 0
3 years ago
Read 2 more answers
Distributed computing is a term that describes the work that autonomous computers can do to achieve a common goal, especially in
Bond [772]

Answer:

To find the solution of Global warming, to find the combination of some drugs and test them, etc.

Explanation:

Distributed computing can be described as when a number of computers connected on the network communicate with each other by passing messages, and these systems are known as distributed systems.

There are various goals that can be accomplished using distributed computing, one of them is to find the solution of Global warming, by coordinating with different areas.  

Another one is to find the combination of some drugs and test them to make new medicine.

7 0
2 years ago
In a computer instant messaging​ survey, respondents were asked to choose the most fun way to​ flirt, and it found that ​P(D)equ
MA_775_DIABLO [31]

Answer:

P(D) = 0.4

Explanation:

P(D) is the probability of randomly selecting someone.

who does not choose a direct​ in-person encounter as the most fun way to flirt.

1 – 0.600 = 0.4

P(D) = 0.4

hence the upper D over bar right parenthesis represent and its value is 0.4

8 0
3 years ago
Other questions:
  • #TODO: Define a data structure to keep track of which links are part of / not part of the spanning tree.
    14·1 answer
  • What is the communications activity of the Internet called
    15·1 answer
  • The CMOS battery located on a computer's motherboard allows for maintaining the correct time and date information stored in CMOS
    7·1 answer
  • @anthonydboss23<br><br> it’s goldielove6 <br><br> .....this is not a question everyone ignore this
    11·2 answers
  • How do you get banned? By getting reported? Or do admins watch whats posted?
    9·1 answer
  • A circuit breaker will do which of the following
    12·1 answer
  • Someone plz answer
    8·1 answer
  • PLEASE HELP <br> Which of the following best describes the existence of undecidable problems?
    7·1 answer
  • Transitive spread refers to the effect of the original things transmitted to the associate things through the material, energy o
    6·1 answer
  • What is the main advantage of using DHCP?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!