Question: In Java, please! String peopleNames is read from input. peopleNames contains people names separated by dots ( ' . ' ) . Count the number

In Java, please!
String peopleNames is read from input. peopleNames contains people names separated by dots ('.'). Count the number of dots ('.') in peopleNames.
Ex: If the input is Mia.Cam.Bob.Gil, then the output is:
Dot found at index 3
Dot found at index 7
Dot found at index 11
Dot occurs 3 times
import java.util.Scanner;
public class FindDots {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String peopleNames;
int i;
int numOccurrences =0;
peopleNames = scnr.nextLine();
//enter your code here
System.out.println("Dot occurs "+ numOccurrences +" times");
}
}
 In Java, please! String peopleNames is read from input. peopleNames contains

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!