Suppose that we are working for an online service that provides a bulletin board for its users. We would like to give our users the option of filtering out profanity. Suppose that we consider the words cat, dog, and llama to be profane. Write a program that reads a string from the keyboard and tests whether the string contains one of our profane words. Your program should find words like cAt that differ only in case. Option: As an extra challenge, have your program reject only lines that contain a profane word exactly. For example, Dogmatic concatenation is a small category should not be considered profane.

This project provides an opportunity to discuss some of the difficulties of in filtering information. It requires a conversion to lowercase and a compound Boolean expression.

See the code in ProfaneFilter.java.

Computer Science & Information Technology

You might also like to view...

What are the disadvantages to writing data to a text file using tokens and delimiters as opposed to writing an entire object to a file at once?

What will be an ideal response?

Computer Science & Information Technology

In terms of complexity, what is the worst-case scenario for an insertion sort?

A. O(n2) B. O(n) C. O(log2n) D. O2

Computer Science & Information Technology