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
Web Development and Design Foundations with HTML5 (8th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Python (4th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Modern Database Management
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Lab Activity: In python.arrow_forwardPalindrome is a word that reads the same backward as forward, e.g., madam or racecar. Write a Boolean method isPalindrome() to validate if a String is a palindrome. Call the method from main() with appropriate input/output to validate your code.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
- Write a method isPalidrome(String arg) that determines if a String is palindrome or not. Palindrome is when a String remains the same after reversing. The method should return boolean typeWrite a method isPalidrome(String arg) that determines if a String is palindrome or not. Palindrome is when a String remains the same after reversing. The method should return boolean typearrow_forwardCreate 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_forward
- public static String pancakeScramble(String text) This nifty little problem is taken from the excellent Wolfram Challenges problem site where you can also see examples of what the result should be for various arguments. Given a text string, construct a new string by reversing its first two characters, then reversing the first three characters of that, and so on, until the last round where you reverse your entire current stringarrow_forwardMad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways. Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit. Ex: If the input is: apples 5 shoes 2 quit 0 the output is: Eating 5 apples a day keeps the doctor away. Eating 2 shoes a day keeps the doctor away. Note: This is a lab from a previous chapter that now requires the use of a loop. My code user_input = input()while True: item = user_input.split()[0]item_count = int(user_input.split()[1])if item.lower() == "quit":break print("Eating " + str(item_count) + " " + item + " a day keeps the doctor away.")arrow_forwardA program has a string variable fullName that stores a first name, followed by a space, followed by a last name. There are no spaces in either the first or last names. Here are some examples of fullName values: "Anthony Coppola", "Jimmy Carroll", and "Tom DeWire". Consider this code segment that extracts the last name from a fullName variable, and stores it in last Name with no surrounding blanks: int k = fullName.indexOf(" "); //find index of blank String lastName = /* expression */ Which is a correct replacement for /* expression */? II fullName.substring(k + 1); III fullName.substring(k + 1, fullName.length());arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT