Write a
See an adviser, talk to him, and listen to him.
should produce the following suggested changed version of the sentence:
See an adviser, talk to her or him, and listen to her or him.
Be sure to preserve uppercase letters for the first word of the sentence. The pronoun “his” can be replaced by “her (s)”; your program need not decide between “her” and “hers”. Allow the user to repeat this for more sentences until the user says she or he is done.
This will be a long program that requires a good deal of patience. Your program should not replace the string “he” when it occurs inside another word, such as “here” 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. Allow your sentences to be up to 100 characters long.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Degarmo's Materials And Processes In Manufacturing
Web Development and Design Foundations with HTML5 (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- 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_forwardA very known application in natural language processing is to extract information from a given text. In this lab, you will be able to extract some emotions (Sad and Happy) from a given string and calculate the score of each emotion. You will be given below the words that express sadness, anger, and happiness. For each word, you will be given weight as well, so that when you are calculating for example the score for sadness in the text (string), you can use this formula:arrow_forward3. 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 February March ...", in which you add spaces such that each month name has the same length. Then use substring to extract the month you want.arrow_forward
- Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characters with a period at the end. For example: "This is a possible value of sentence."arrow_forwardWe 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_forwardWrite a program which concatenates two strings "I LOVE" and "YOU.", checks for presence of the character "." replaces it with "!", and prints out the final string.arrow_forward
- Write a JAVA program that asks the user to input the instructor Salary (double) and Academic Rank (String) as “Assistant" ,"Associate" ,or "Lecturer" (ignore case). Assume all inputs are valid and there is no need for validation. Your program should display the Tax amount and Net Salary as follows: Tax Amount = Salary x Tax Rate Net Salary= Salary – Tax Amount Tax Rate can found from the following table Academic Rank Tax Rate Assistant Associate 10% 15% Lecturer 5% Sample Input / Output Enter instructor Salary and Academic Rank: 955.7 Assistant Tax Amount = BD 95.570 Net Salary = BD 860.13 Note: Your answer should follow the given sample input / output.arrow_forwardA cryptogram is a coded message using alphabet substitution. For example, the letter "A" in the cryptogram might stand for the letter “Ż." You are to write a program that allows the program user to decipher cryptograms, like the following one. Your program should allow the user to change one letter and display the change, then change another letter and display the change etc. Here is a sample cryptogram to be decoded. String crypto.Part1 = "EKBQUDUHJ XK BCA AYGADDAMB KGENAHUEB UP" String crypto.Part2 = "BCA ZUQDR FDEIA BCA KBEWQK PUG UOQ PEODBK." String crypto.Part3 = "CUZALAQ PQXAMRK UOQ EODBK DXA MUB IM BCA" String crypto.Part4 = "KBEQK FOB XM UOQKADLAK."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_forward
- Read a 3-character string from input into variable inString. Declare a Boolean variable allAlphas and assign allAlphas with true if inString only contains alphabetic characters. Otherwise, assign allAlphas with false. Ex: If the input is mgg, then allAlphas is assigned with true, so the output is: String is valid Ex: If the input is ^zc, then allAlphas is assigned with false, so the output is: String is not valid Note: Use getline(cin, inString) to read the entire line from input into inString. #include <iostream>#include <string>#include <cctype>using namespace std; int main() { string inString; /* Your code goes here */ if (allAlphas) { cout << "String is valid" << endl; } else { cout << "String is not valid" << endl; } return 0;}arrow_forwardRead a 2-character string from input into variable userString. Declare a Boolean variable isValid and assign isValid with true if userString does not contain any uppercase letters. Otherwise, assign isValid with false. Ex: If the input is 86, then isValid is assigned with true, so the output is: Good string Ex: If the input is BQ, then isValid is assigned with false, so the output is: Bad string Note: Use getline(cin, userString) to read the entire line from input into userString. #include <iostream>#include <string>#include <cctype>using namespace std; int main() { string userString; /* Your code goes here */ if (isValid) { cout << "Good string" << endl; } else { cout << "Bad string" << endl; } return 0;}arrow_forwardThe internet enables people to network, join a cause, take a poll, etc. Your program will prompt the user for a description of a poll to be taken and then prompt 5 users for a response of 1-10 (1 being a 'poor' response; 10 being the 'best' response).Your program does not have to validate that the user entered 1-10. We'll do that type of checking later.Your program must use a string data type to store the poll description and a Python list data type to save the integer responses of the 5 user responses.Your output should list all the responses stored in the list, the highest given response, the lowest given response and the average of the 5 responses. See sample input and utput below.Review powerpoint 3, slide 21 for an example if you need one. Sample interactive run of your program: Give a simple description of the poll to be takenRate your understanding of the first 3 zyBook chaptersEnter a 1-103Enter a 1-1010Enter a 1-104Enter a 1-102Enter a 1-105Sample outputRate your understanding…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning