Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Jump to level 1 Declare a Boolean variable named allValid. Then, read integer numln from input representing the number of integers to be read next.
Jump to level
Declare a Boolean variable named allValid. Then, read integer numln from input representing the number of integers to be read
next. Use a loop to read the remaining integers from input. If any of the numln integers are in the range to inclusive,
assign allvalid with false. Otherwise, assign allvalid with true.
Code at the end of main outputs "All valid values if allvalid is true or "Invalid values if allValid is false.
Ex: If the input is:
then the output is:
Invalid value
import java.util.Scanner;
public class IntegerReport
public static void mainString args
Scanner scnr new Scanner
System.in;
int numIn;
Additional variable declarations go here
Your code goes here
if allvalid
System.out.printlnAll valid values;
else
System.out.printlnInvalid values;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started