Question: 5 9 7 7 0 8 . 4 3 9 2 2 7 4 . qx 3 zqy 7 Jump to level 1 Integer userIn
qxzqy
Jump to level
Integer userIn is read from input. Write a while loop that iterates until userIn is negative. In each iteration:
Update integer finalVal as follows:
If userln is even, output "lose" and do not update finalVal.
Otherwise, output "win" and increment finalVal.
Then, read the next integer from input into variable userln.
End each output with a newline.
grad Click here for example
lose
win
lose
Final value is
Note: returns true if is even.
import java.util.Scanner;
public class ResultCalculator
public static void mainString args
Scanner scnr new Scanner
System.in;
int userIn;
int finalVal;
finalVal ;
userIn scnrnextInt;
System.out.printlnFinal value is finalVal;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
