Question: Stuck on the java problem below, help completing the problem would be appreciated thank you! PROBLEM: Complete this program, prompting the user to to enter
Stuck on the java problem below, help completing the problem would be appreciated thank you!
PROBLEM: "Complete this program, prompting the user to to enter two positive numbers a and b so that a is less than b. "
CODE BELOW:
import java.util.Scanner;
public class TwoNumbers { public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean i = true;
// Keep prompting the user until the input is correct System.out.println("Enter two positive integers, the first smaller than the second."); System.out.print("First: "); int a = in.nextInt(); System.out.print("Second: "); int b = in.nextInt();
// Only print this when the input is correct System.out.println("You entered " + a + " and " + b); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
