Multiple Choice
What is the output of this code snippet if the user enters the numbers 1 2 3 4 -1 5?
Double total = 0;
Boolean hasValidNumber = true;
Scanner in = new Scanner(System.in) ;
While (in.hasNextDouble() && hasValidNumber)
{
Double input = in.nextDouble() ;
If (input < 0)
{
HasValidNumber = false;
}
Else
{
Total = total + input;
}
}
System.out.println(total) ;
A) 15.0
B) 14.0
C) 12.0
D) 10.0
Correct Answer:

Verified
Correct Answer:
Verified
Q10: Choose the loop that is equivalent to
Q23: How many times is the text "Let's
Q38: In the _ loop header, you can
Q59: What is the output of the following
Q67: What is the output of the code
Q72: Which of the following for loops is
Q84: What is the last output line of
Q95: In the following code snippet, when does
Q107: Which statement about storyboards is true?<br>A)A storyboard
Q127: Which of the following loops executes exactly