10. A data verification loop is a loop that asks the user to input a value withi
ID: 3762079 • Letter: 1
Question
10.
A data verification loop is a loop that asks the user to input a value within a restricted range
repeatedly until the user has input a value within the requested range. Write a data verification
loop that that inputs an int value x within the range 0 and 100. Assume that a Scanner called “Keyboard” has been defined for keyboard input.
10.
A data verification loop is a loop that asks the user to input a value within a restricted range
repeatedly until the user has input a value within the requested range. Write a data verification
loop that that inputs an int value x within the range 0 and 100. Assume that a Scanner called “Keyboard” has been defined for keyboard input.
Explanation / Answer
int n = 101; //assume false condition
while(n < 0 || n > 100){
n = keyboard.nextInt();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.