Question: Jump to level 1 String stringFields is read from input. stringFields contains fruit names separated by slashes ( ' / ' ) . For each
Jump to level
String stringFields is read from input. stringFields contains fruit names separated by slashes For each slash in stringFields, increment numOccurrences by and output "Slash found at index followed by the index of the slash character.
Ex: If the input is grapefruitorangeapricotberryapplenectarine then the output is:
Slash found at index
Slash found at index
Slash found at index
Slash found at index
Slash found at index
Slash occurs times
import java.util.Scanner;
public class FindSlashes
public static void mainString args
Scanner scnr new ScannerSystemin;
String stringFields;
int i;
int numOccurrences ;
stringFields scnrnext;
Your code goes here
System.out.printlnSlash occurs numOccurrences times";
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
