import java.util.Scanner; public class NumberPrompt { public static void main (S
ID: 672321 • Letter: I
Question
import java.util.Scanner;
public class NumberPrompt {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int userInput = 0;
/* Your solution goes here */
System.out.println("Your number < 100 is: " + userInput);
return;
}
}
Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25
import java.util.Scanner;
public class NumberPrompt {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int userInput = 0;
/* Your solution goes here */
System.out.println("Your number < 100 is: " + userInput);
return;
}
}
Explanation / Answer
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class NumberPrompt
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scnr = new Scanner(System.in);
int userInput = 0;
do
{
System.out.println("Enter a number < 100 : ");
userInput = scnr.nextInt();
}while(userInput>100);
System.out.println("Your number < 100 is: " + userInput);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.