Is there a way to create a java
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 rabbit to be profane. Write a program that reads a string from the keyboard and test whether the string contain any one of these words. Your program should find words like cAt that differ only in case. Have your program reject only lines that contain one or more of the three words exactly. For example, concatenation is a small category should not be considered profane. This problem can be solved easily. If you add a space to the beginning of the string and a space at the end of the string you only need to check if space cat space or space dog space or space rabbit space is in the string. Use three if statements; one for each word. If one or more of the words are there set the boolean variable profane to true. In each if statement that has its word in the string print that that word was found. Print out the value of profane at the end.
There is a String method contains. It has a String parameter and returns a boolean value indicating if the parameter is in the String being examined. Example: if(inputStirng.contains(“ cat ”))// will return true if the String “ cat ” is in the String inputString.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- Write Java code to read strings of lower-case letters from the keyboard and count the number of vowels in each word. (vowels are a,e,i,o and u). When all strings have been read in, print the string that has the largest number of vowels (duplicates included) and how many vowels were in the string. When more than one string has the greatest number of vowels, print the first string found with that number. For example, with input of she groceries yourselves here radio, the correct answer would be: groceries – 4 vowels.arrow_forwardWrite a Java Program to take a string from the user and Your task is to find the length of longest palindrome string that can be made from that string.arrow_forwardCreate a method in JAVA that returns a string when it receives three intsarrow_forward
- Design a java program with an algorithm that will take a string from the user and then decide if each character in that string is unique. For example, if you ask the user to enter a string and that user enters the world ‘hello’, the result of the algorithm implementedshould return ‘false’ or ‘not unique’. If the user enters a string such as the word ‘phone’ the program will return ‘true’ or ‘unique’ since every character in the word phone is unique and is not repeated. An example of this program follows: Output should show as : enter a string rizma This string has all the unique characters would u like to continue?(y for yes n for no) y Enter a string waali This string is not uniquearrow_forwardIn JAVA language. Given a string jv = "JAVA", write a program such that the string to be printed in output should be "AVAJJAVA".arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education