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
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Java How To Program (Early Objects)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Computer Science: An Overview (12th Edition)
Starting Out with C++: Early Objects
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
C++ How to Program (10th Edition)
- Create a function that tracks how many times a phrase appears in a string. An number must be returned by the function. Never presume that a string of words can contain punctuation and only one space between words. Create the method with either a String argument or a StringBuilder object so that it can be used.arrow_forwardLab Activity: In python.arrow_forwardWrite a program that finds word differences between two sentences. The input begins with the first sentence and the following input line is the second sentence. Assume that the two sentences have the same number of words. The program displays word pairs that differ between the two sentences. One pair is displayed per line. Ex: If the input is: Smaller cars get better gas mileage. Tiny cars get great fuel economy then the output is: Smaller Tiny better great gas fuel mileage economy Hint: Store each input line into a list of strings. 461710,3116374.qx3zqy7arrow_forward
- PLEASE HELP ME FIND THE JAVA CODE FOR THIS PROBLEM 4. Is It You, Cody? by CodeChum Admin Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct. Now, will you take on this task? Input A line containing four one-letter strings separated by a space. c·O·D·y Output A line containing a string. Correctarrow_forwardin python "AnagramMake a method is_anagram_of(a,b) that tests if a is an anagram of b.A string a is an anagram of a string b, if it uses exactly the same letters, but the order can be different.Spaces are ignored, as well as capitalization.Examples of anagrams:"eleven plus two" - "twelve plus one""William Shakespeare" - "I am a weakish speller""Tom Marvolo Riddle" - "I am Lord Voldemort""Anagrams" - "Ars manga""television ads" - "enslave idiots"Counter examples:"bla" - "aalb""cat" - "tact"Hint: Make a dictionary that holds how often a letter occurs in a word."""def is_anagram_of(a, b):passarrow_forwardA palindrome is a word or phrase that reads the same forward and backward, ignoring blanks and considering uppercase and lowercase versions of the same letter to be equal. For example, the following are palindromes:warts n strawradarAble was I ere I saw Elbaxyzczyx Write a program that will accept a sequence of characters terminated by a period and will decide whether the string—without the period—is a palindrome. You may assume that the input contains only letters and blanks and is at most 80 characters long. Include a loop that allows the user to check additional strings until she or he requests that the program end. Hint: Define a static method called is Palindrome that begins as follows: /** Precondition: The array a contains letters and blanks in positions a[0] through a[used − 1]. Returns true if the string is a palindrome and false otherwise. */ public static boolean is a palindrome(char[] a int used) Your program should read the input characters into an array whose base…arrow_forward
- Create a function that tallies the number of times a phrase appears in a string. The function's output should be a number. Don't presume that a single space divides words, and that a string can contain punctuation. Create the method so that it can accept a String input or a StringBuilder object.arrow_forwardA kidnapper kidnaps you and writes a ransom note. He does not write it by hand to avoid having his hand writing being recognized, so he uses a magazine to create a ransom note. We need to find out, given the ransom string and magazine string, is it possible to create a given ransom note. The kidnapper can use individual characters of words. Here is how your program should work to simulate the ransom problem: ▪ your program should prompt the user to enter a long String to represent the magazine and another short String to represent the required ransom note. ▪ your program needs to check if the magazine string contains all required characters in equal or greater number present in the ransom note. ▪ your program should print true if it is possible to create the given ransom note from the given magazine, and print false otherwise. ▪ Break up your code into a set of well-defined functions. Each function should include a comment block that briefly describes it, its parameters and…arrow_forwardlanguage using - Javaarrow_forward
- Palindromes - “A palindrome” is a string that reads the same from both directions. For example: the word "mom" is a palindrome. Also, the string "Murder for a jar of red rum" is a palindrome. - So, you need to implement a Boolean function that takes as input a string and its return is true (1) in case the string is a palindrome and false (0) otherwise. - There are many ways to detect if a phrase is a palindrome. The method that you will implement in this task is by using two stacks. This works as follows. Push the left half of the characters to one stack (from left to right) and push the second half of the characters (from right to left) to another stack. Pop from both stacks and return false if at any time the two popped characters are different. Otherwise, you return true after comparing all the elements. Phrases of odd length have to be treated by skipping the middle element like the word "mom", your halves are "m" and "m". - Hint: (without using STL)arrow_forwardPalindromes - “A palindrome” is a string that reads the same from both directions. For example: the word "mom" is a palindrome. Also, the string "Murder for a jar of red rum" is a palindrome. - So, you need to implement a Boolean function that takes as input a string and its return is true (1) in case the string is a palindrome and false (0) otherwise. - There are many ways to detect if a phrase is a palindrome. The method that you will implement in this task is by using two stacks. This works as follows. Push the left half of the characters to one stack (from left to right) and push the second half of the characters (from right to left) to another stack. Pop from both stacks and return false if at any time the two popped characters are different. Otherwise, you return true after comparing all the elements. Phrases of odd length have to be treated by skipping the middle element like the word "mom", your halves are "m" and "m". - Hint: (without using STL)arrow_forwardWrite a program that asks the user to enter 10 numbers, that range from 10-100. Make sure that you do not accept any numbers less than 10, if a user enters a number that is less than 10 then ask him again. Once the user enters all 10 numbers, sort the numbers entered in ascending order and print them out. CSharparrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT