Write a program that reads in a line of text and replaces all four-letter words with...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that reads in a line of text and replaces all four-letter words with the word "love". For example, the input string I hate you, you dodo! should produce the output I love you, you love! Of course, the output will not always make sense. For example, the input string John will run home. should produce the output Love love run love. If the four-letter word starts with a capital letter, it should be replaced by "Love", not by "love". You need not check capitalization, except for the first letter of a word. A word is any string consisting of the letters of the alphabet and delimited at each end by a blank, the end of the line, or any other character that is not a letter. Your program should repeat this action until the user says to quit. Write a program that reads in a line of text and replaces all four-letter words with the word "love". For example, the input string I hate you, you dodo! should produce the output I love you, you love! Of course, the output will not always make sense. For example, the input string John will run home. should produce the output Love love run love. If the four-letter word starts with a capital letter, it should be replaced by "Love", not by "love". You need not check capitalization, except for the first letter of a word. A word is any string consisting of the letters of the alphabet and delimited at each end by a blank, the end of the line, or any other character that is not a letter. Your program should repeat this action until the user says to quit.
Expert Answer:
Answer rating: 100% (QA)
In Given program Read the line of textand replaces all fourletter wordswith the word love If the fourletter word starts with a capital letter it should be replaced byLove not by love You need not chec... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Write a program that reads in a line of text as the text message, and displays the suspicious words in the message. Some words commonly found in smishing attacks include: suspended, locked, bank,...
-
Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: futureInvestmentValue =...
-
Write a program that reads the strings from file SortedStrings.txt and reports whether the strings in the files are stored in increasing order. If the strings are not sorted in the file, displays the...
-
Amy is domiciled in the UK and has lived in the UK all her life. On 1 January 2020 she leaves to work in Australia for two years, returning on 31 December 2021. During her absence she makes no visits...
-
How do computer viruses work?
-
If output rises by 35 percent while hours of work increase by 40 percent, has productivity increased or decreased? By how much?
-
What steps should workers take to determine if their jobs or intended career paths have a higher risk of being automated?
-
Casey Hartwig, CPA, was retained by Global Cable to prepare financial statements for April 2017. Hartwig accumulated all the ledger balances per Globals records and found the following. Casey Hartwig...
-
The Maderas y Maderas company manufactures its products in its only production department. In any period they begin to manufacture a batch of 500 restaurant-type tables, at the end of the period they...
-
Mr. Juan Dela Cruz is a self-employed professional based in the Philippines. He provides consulting services in the field of information technology. As a resident Filipino citizen, Mr. Dela Cruz is...
-
Context and questions Part A: Written Report (appx. 20% of the total grade) Description The world is facing a recession due to the pandemic. The Australian government and the Reserve Bank of...
-
Toyota is one of the worlds largest automobile companies, but it faced a long road to get to this place in history. It wasnt until the company developed its original manufacturing philosophy, the...
-
Some politicians think tariffs will reduce their countries trade deficits. Are they correct?
-
Tesla is one of the most valuable car makers in the world. The company, which also makes energy generation products, has a reputation for industry-disrupting innovation, but Tesla wasnt an overnight...
-
What are the most common reasons that small businesses fail? What steps should entrepreneurs take to protect their firms from failure?
-
What is the role of the business plan?
-
How to fix the error caused by .as_matrix in google colab, as this doesn't work anymore. I have tried using .value and .Numpy and get an error converting numpy to tf from keras.optimizers import SGD...
-
Why is inventory management important for merchandising and manufacturing firms and what are the main tradeoffs for firms in managing their inventory?
-
Write a method to add two matrices. The header of the method is as follows: public static double[][] addMatrix(double[][] a, double[][] b) In order to be added, the two matrices must have the same...
-
Listing 2.7, ShowCurrentTime.java, gives a program that displays the current time in GMT. Revise the program so that it prompts the user to enter the time zone offset to GMT and displays the time in...
-
Assume letters A, E, I, O, and U as the vowels. Write a program that prompts the user to enter a string and displays the number of vowels and consonants in the string. Enter a string: Programming is...
-
Why, in general, is the magnitude of the voltage gain of a common-source amplifier relatively small?
-
Discuss, using the concept of a load line, how a simple common-source circuit can amplify a time-varying signal.
-
Discuss the general conditions under which a common-source amplifier would be used.
Study smarter with the SolutionInn App