Write a program Censor2
that initializes an array of badWords:
String[] badWords = {"poop","stupid","dumb","darn","dagnabbit","damn"};
Then have the user enter a sentence:
Scanner in = new Scanner(System.in);
System.out.println("Enter a sentence, and keep it clean: ");
String oldSentence = in.nextLine();
Then go through the sentence letter by letter, creating a newSentence
that has each letter in a bad word replaced by an asterisk.
Print out the sanitized version of the sentence.
Enter a sentence, and keep it clean:
This is a dumb, stupid assignment. I'd rather be wearing poopy diapers, darnit!
Sanitized:
This is a ****, ****** assignment. I'd rather be wearing ****y diapers, ****it!