Write a
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.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Starting Out with Python (4th Edition)
SURVEY OF OPERATING SYSTEMS
Database Concepts (8th Edition)
Starting Out With Visual Basic (8th Edition)
- 1. Write a program that reads a number between 1,000 and 999,999 from the user, where the user enters a comma in the input. Then print the number without a comma. Here is a sample dialog; the user input is in color: Please enter an integer between 1,000 and 999,999: 23,456 23456 Hint: Read the input as a string. Measure the length of the string. Suppose it contains n characters. Then extract substrings consisting of the first n - 4 characters and the last three characters. 2. Writing large letters. A large letter H can be produced like this: * It can be declared as a string literal like this: final string LETTER_H = "* *%n* *n*****n* *n* *%n"; Print the string with System.out.printf. The en format specifiers cause line breaks in the output. Do the same for the letters E, L, and O. Then write in large letters: O 3. Write a program that transforms numbers 1, 2, 3,..., 12 into the corresponding month names January, February, March, ..., December. Hint: Make a very long string "January…arrow_forwardQ12,. A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is not a palindrome..arrow_forwardWrite a program to: Store the following message into a string (DO include periods!):I am the door of the sheep. All who came before me are thieves and robbers, I am the door. Insert the following message after the comma in the string.but the sheep did not listen to them. Output the string to the screen with a new line at the end. Replace the following words in the string.a. “I” and "me" with “Jesus”b. “am” with “is”Note: Make sure you only replace the word “ am“ and not the letters “am" that might appear in that sequence in another word Output the string with a new line at the end. The final output should be as follows: Jesus is the door of the sheep. All who came before Jesus are thieves and robbers, but the sheep did not listen to them. Jesus is the door. Write in C++arrow_forward
- write a program that inserts parentheses, a space, and a dash into a string of 10 user-entered numbers to format it as a phone number. for example 5555555555 becomes (555) 555-5555. If the user does not enter exactly 10 digits, display an error message. continue to accept user input until the user enters 999 using string builder.arrow_forwardWrite in Java Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. Ex: If the input is:arrow_forwardWrite a program that asks the user to enter a word that contains the letter a. The program should then print the following two lines: On the first line should be the part of the string up to and including the first a, and on the second line should be the rest of the string. Sample output is shown below:Enter a word: buffalobuffaloarrow_forward
- Write a java program. Zeeshan wanted to increase his typing speed competative programming contests. His friend suggested him to type the sentence "the quick brown fox jumps over the lazy dog" repeatedly. This sentence is called pangram because it contains every letter of the alphabet. After typing the sentence several times, Zeeshan became bored with it so he started to look for the pangrams. Given a sentence s as a string, determine weather it is a pangram or not. Assume that thestring would be in lowercase. Write a method named isPangramSentence(String sentence) thet accepts a string asargument and return true if the sentence is true if the sentence is pangram otherwise returns false.arrow_forward1. Write a pyrhon program that prints out a classic hangman stick figure. The program should ask the user to enter a number from 1-6 and the corresponding hangman should be printed. The value the user inputs corresponds to the number of incorrect guesses in a real hangman game and so the completeness of the hangman will correspond to the number of ‘incorrect guesses’ inputted by the user (e.g., if the user enters 1, then only the head of the hangman will be printed; full example below). Example:Enter a number from 1-6: 1O Enter a number from 1-6: 2O|Enter a number from 1-6: 3O\||Enter a number from 1-6: 4O\|/|Enter a number from 1-6: 5O\|/|/Enter a number from 1-6: 6O\|/|/ \ 2. Modify your program from problem 1 so that the user input is checked to be a validsingle digit (1-6) before printing the corresponding hangman. If the input is not valid, theninstead of a hangman the following message should be printed “Invalid input: you must enter asingle number from 1-6.” Example:Enter a…arrow_forward6. Write a Python program that inputs a sentence string by the user and counts thenumber of words in the sentence.7. Write a Python program that inputs a large integer and outputs this integer withcommas inserted at every 3 digits. For example, when 5231908126 is entered,the output is 5,231,908,126.arrow_forward
- We want to create a program that reads a string and removes from it the characters between two marker characters. For example for the input text: (to buy) We need to buy (i) milk, (ii) eggs, (iii) flour, and (iv) sugar. And using "(" and ")" as the starting and ending markers, the program should output: We need to buy milk, eggs, flour, and sugar. Notice that the number of characters between the markers, and the number of markers present in the string may vary. We will assume that if a starting marker appears in the input text, its corresponding ending marker is also present in the string. Approach: The idea is to copy characters from the input text to an output string variable as long as we have not found the starting marker. From that point on, we ignore the characters in the input text until we find the ending marker. Once we find the ending marker, we resume copying characters to the output string variable, and the process repeats. Drag into the placeholders below the appropriate…arrow_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_forwardPlease &-. Write a Java program to check if a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward, ignoring spaces, punctuation, and capitalization. For example, "racecar" and "Madam" are palindromes, while "hello" and "Java" are not. Your program should take a string as input and return true if it's a palindrome, and false otherwise. Ik.?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