I want to count the entries(Strings) written in console that end in "im", so how can I do it as a starter?
import java.lang.String;
import java.util.Scanner;
public class WordCount {
public static void main (String[]args){
final String SENTINEL = "END";
Scanner sc = new Scanner(System.in);
String text = "xy";
do {
System.out.print("Type a text or type "+SENTINEL+" when you are done. ");
text = sc.nextLine();
} while(!text.equalsIgnoreCase(SENTINEL));
boolean IMcheck = text.endsWith("im");
int count = 0;
if(IMcheck == true){
count++;
}
System.out.println("You have typed "+ count +" texts that end in \"im\" ");
}
}