Question: Assume that you are writing a program which asks the user for a grade. You want this program to prevent the user from entering any

Assume that you are writing a program which asks the user for a grade. You want this program to prevent the user from entering any grades that are outside the range of [0,100]. You are using the following program segment to query the user until a single proper grade is entered.
int grade = input.nextInt();
while (?????){
System.out.print(That is invalid. Enter a grade: ); grade = input.nextInt();
}
Which of the following conditions can be put in place of the ????? in the while loop to accomplish the desired task?
I. grade<0||grade>100
II.!(grade <0)||!(grade >100)
III. !(grade >=0 && grade <=100)
(A) I only
(B) I and II only
(C) II and III only
(D) I and III only
(E) I, II and III

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!