Question: java for begginers, help please Lab 08: Console Input and Output Objectives: After the completion of this lab, students should be able to: Use the

java for begginers, help please java for begginers, help please Lab 08: Console Input and Output Objectives:

Lab 08: Console Input and Output Objectives: After the completion of this lab, students should be able to: Use the System.out.printf() method to display formatted outputs. Use the import declarations in the program. Use the Scanner class to input data from the keyboard. Use the Math class methods for performing basic mathematical operations. Use the Math.random() method and the Random class to generate random numbers. Lab Exercises: Lab Exercise 1 - Swap Two Numbers het Gadda Problem Description: Write a Java program (Swap2Numbers.java) that swaps (interchanges) the values of two integer variables (x and y) using third variable, temp. For example, if in your Java program you have defined two variable x and y where x = 4 and y = 5, then before swapping x = 4 and y=5 and after swapping * = 5 and y=4. Tips: Use the Math.random() method to generate two random integers between 1 and 100, inclusive. Use a print statement to display the outputs as shown below. Sample output: Before swapping x = 40 y = 25 After swapping x=25 y = 40 Note: your program's output can be different

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!