Question: Use scnr . nextInt ( ) to read remaining integers from input into inputValue until - 1 0 0 0 is read. For each integer

Use scnr.nextInt() to read remaining integers from input into inputValue until -1000 is read. For each integer read before -1000:
If the integer is positive, output the integer followed by " found" and increment countOfPositive.
Otherwise, output the non-positive integer.
End each output with a newline.
Ex: If the input is 95-1410-1000, then the output is:
9 found
5 found
-14
10 found
Positive integers occur 3 time(s)
Note: The sentinel value is -1000.
import java.util.Scanner;
public class CountOfPositive {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int inputValue;
int countOfPositive;
countOfPositive =0;
inputValue = scnr.nextInt();
while (/* Your code goes here */){
/* Your code goes here */
}
System.out.println("Positive integers occur "+ countOfPositive +" time(s)");
}
}

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!