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
Q107: Which statement about storyboards is true?<br>A)A storyboard
Q108: Which of the following is correct for
Q109: How many times does the following loop
Q110: In the following code snippet, when does
Q111: Assume the following variable has been declared
Q113: What is the outcome of the following
Q114: What is the output of the code
Q115: What are the values of i and
Q116: Insert a statement that will correctly terminate
Q117: Which of the following conditions can be