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
What is computer-aided design/computer-aided manufacturing (CAD/CAM)? a.A cultural trend that places value on an individual's ab
masha68 [24]

Answer:

C. RFID tag Systems are used to create the digital designs and then manufacture the products

7 0
4 years ago
What medical equipment do they have in Jr. high, To help save peoples lives?
lawyer [7]

Vital signs monitors, Electronic Medical Records (EMR), and Medication Management Systems.

5 0
3 years ago
List the steps to identify address or link window on a phone​
Law Incorporation [45]

Answer: this is how

Explanation: if you are on your phone and a link pops up if it is blue then it is able to be clicked but if it is not blue you can simply copy and paste the link into your web browser.

7 0
3 years ago
Why is a non-trivial or predictable classification system preferred in systematics?
spayn [35]
A non-trivial or predictable classification system is preferred in systematics for the reason that, it is <span> repeatable, objective, testable and </span>predictable. Predictable in a way that you <span>get more out of it than what you put in it. Hope this answers your question.</span>
4 0
3 years ago
Complete the statement using the correct term.
vladimir1956 [14]

The BODY of the site is what will be displayed on the web page. It contains most of the distinctive content of the web page.

A web page refers to a document exhibited by the browser, which is generally written in the HTML language.

The body of a web page is a big area in the center that contains the most important and distinctive content of a web page.

The body will determine the central content of the HTML document, which will be observable on the web page (e.g., a photo gallery).

Learn more about a web page here:

brainly.com/question/16515023

5 0
3 years ago
Other questions:
  • Are the advantages of a climate control in a vehicle
    10·2 answers
  • Modify the Eggs program to create a new one named EggsInteractive that prompts the user for and accepts a number of eggs for eac
    13·1 answer
  • A TCP entity opens a connection and uses slow start. Approximately how many round-trip times are required before TCP can send N
    11·1 answer
  • You would like to set up on online meeting to communicate with colleagues on a group project. Which of these tools should you su
    5·2 answers
  • Will a pair of bar magnet ,with keepers on the two ends, act as a magnet
    13·1 answer
  • Suppose we are given an arbitrary digraph G = (V, E) that may or may not be a DAG. Modify the topological ordering algorithm so
    8·1 answer
  • Every computer consists of physical components and nonphysical components. the nonphysical components of a computer that underst
    9·1 answer
  • What are the benefits of maintaining you vehicle?
    11·1 answer
  • How can you determine if the story is told in the third person
    5·1 answer
  • _________ is an alternative name for the main memory.help me​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!