Problem

Swapping Values In this lab, you will complete a Java program that swaps values stored...

Swapping Values

In this lab, you will complete a Java program that swaps values stored in three int variables and determines maximum and minimum values. The Java file provided for this lab contains the necessary variable declarations, as well as the input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate. Comments included in the code tell you where to write your statements.

I. Open the source code file named Swap.java using the text editor of your choice.

2. Write the statements that test the first two integers, and swap them if necessary.

3. Write the statements that test the second and third integer, and swap them if necessary.

4. Write the statements that test the first and second integers again, and swap them if necessary.

5. Save this source code file in a directory of your choice, and then make that directory your working directory.

6. Compile the source code file, Swap.java.

7. Execute the program using the following sets of input values, and record the output.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 8
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT