Explanation of Solution
Given input check “do-while” loop:
//declaring variable value
int value;
//define "do-while" loop
do
{
//prompt the range of input
System.out.print("Enter an integer < 100: ");
//scan for the input value
value = in.nextInt();
//while condition to stop
} while (value >= 100);
Explanation:
In the above code snippet,
- A variable named “value” is created.
- A “do-while” loop is executed up to the condition “value >= 100”.
- Prompt the range of the input integers.
- Scan for the input integers using object “in”.
Program for checking input greater than “0” and less than “100”:
//import required header files
import java.util.Scanner;
//define class Range
publicclassRange
{
//define main method
publicstaticvoid main(String[] args)
{
//declaring variable value
int value;
//declaring the object of Scanner class
Scanner in=new Scanner(System...
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Big Java, Binder Ready Version: Early Objects
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education