Question: JAVA: Integer jeansCount is initialized with 0 . String nextItem is read from input. Using the following code, write a while loop that iterates until

JAVA: Integer jeansCount is initialized with 0. String nextItem is read from input. Using the following code, write a while loop that iterates until nextItem is equal to "Done". In each iteration of the loop:
Increment jeansCount if nextItem is equal to "Jeans".
Read string nextItem from input. import java.util.Scanner;
public class SimpleWhileLoop {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String nextItem;
int jeansCount;
jeansCount =0;
nextItem = scnr.next();
/* Your code goes here */
System.out.println("Jeans occurs "+ jeansCount +" 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!