This is what I have so far:
import java.util.Scanner;
public class InputFilter {
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
String word;
System.out.print("Enter the words 'stop' 'end' or 'done' when finished");
word = keyboard.next();
while ( !word.equalsIgnoreCase(("stop")){ ;
System.out.println();
word = keyboard.next();
}
}
}
This...sucks so far. Tried to use ("stop")||("end")||("done") but it didnt like it. I thought maybe I could first put all the words into a sentence then use str.replaceAll to replace "a" "an" and "the" with blank spaces but I cant even mess with that until I can get all the words input. The best Ive been able to do is get to return the last word put it or return all the words separately.
Any help would be awesome because I have no idea and I cant seem to find anything online quite like this

New Topic/Question
Reply




MultiQuote






|