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++, Student Value Edition
Additional Engineering Textbook Solutions
Experiencing MIS
Database Concepts (7th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Using MIS (10th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
- Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.”arrow_forwardWrite a python program that takes a string as an input from the user and checks if there are any groups of THREE consecutive vowels. The input string will be a random combination of small letter and capital letter characters. Then replace all the three consecutive vowels with “#” character. So, the presence of such a group is ensuredarrow_forwardwrite a program that allows the input of a string from the user and prints the longest word in that string and its length. If there are multiple words with the same maximum length you must print the first one only.arrow_forward
- Write a Python program to find the first appearance of the substring 'too' and 'good' from a given string. If 'good' follows the 'too', replace the whole 'too'' good' substring with 'excellent' and print the resulting string. If the above does not appear, print the string as it is. Sample InputThe book is not too good!This book is good too! Sample OutputThe book is not excellent!This book is good too!arrow_forwardWrite a program that plays a guessing game with the user. The user should pick a letter, and the computer should try to guess the letter. After each guess, the user should tell the computer whether its guess was too high or too low. With this information, the computer should be able to guess the letter within five tries. The user should be able to give whole words or single upper or lower case letters as responses. c++arrow_forward• Write a program that examines three variables - p, q, and r - andprints the smallest even number among them.• If none of them are even, it should print the largest value of thethree.arrow_forward
- Write regular expressions for the following languages. By “word”, we mean an alphabetic string separated from other words by whitespace, any relevant punctuation, line breaks, and so forth. (a) The set of all alphabetic strings;(b) The set of all lower case alphabetic strings ending with a letter b;(c) The set of all strings with two consecutive repeated words (e.g., “Humbert Humbert” and “the the” but not “the bug” or “the big bug”);(d) All strings that start at the beginning of the line with an integer and that end at the end of the line with a word;(e) All strings that have both the word grotto and the word raven in them (but not, e.g., words like grottos that merely contain the word grotto);arrow_forwardWrite a Java program to get a sub string of a given string. Print the original string, and the sub string out of the original. (Use substring() method in the slides Lecture on Methods.pdf) The given string is: "Continuously provide feedback loops in satisfying its clients through metrics." The strings to be collected from the original string are: feedback, clients, metricsarrow_forwardWrite a program that will analyze a string by counting the number of each alphabetic letter in the stringand then printing a vertical histogram showing the frequency of the letters in the string.For example, if text = "I love problem-solving.", your program should plot when thehistogram is printed: * * * * * * * * * * * * * * * * * * *---------------------------------------------------a b c d e f g h i j k l m n o p q r s t u v w x y zNote that all special characters including blanks are ignored and alphabet letters are caseinsensitive.Create your source code file named Lab10FirstnameLastname.java in NetBeans and add thefollowing menu to the main method in the Lab10FirstnameLastname class.T: Enter a text stringP: Plot alphabetic frequencies in the stringQ: QuitSelect an option:Add the following Histogram class to your source code file and complete the setText(Stringt) and drawHistogram() methods to do the work for options T and P in your main menu.The setText(String t)method changes…arrow_forward
- Write a program that reads HAND_SIZE cards from the user, then analyzes the cards and prints out the type of poker hand that they represent. (HAND_SIZE will be a global constant, typically 5, but your program must still work if it is set to something other than 5.) Poker hands are categorized according to the following hand-types: Straight flush, four of a kind, full house, straight, flush, three of a kind, two pairs, pair, high card. To simplify the program we will ignore card suits, and face cards. The values that the user inputs will be integer values from LOWEST_NUM to HIGHEST_NUM. (These will be global constants. We'll use LOWEST_NUM = 2 and HIGHEST_NUM = 9, but your program must work if these are set to something different.) When your program runs it should start by collecting HAND_SIZE integer values from the user and placing the integers into an array that has HAND_SIZE elements. It might look like this: Enter 5 numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card…arrow_forwardWrite a program that reads HAND_SIZE cards from the user, then analyzes the cards and prints out the type of poker hand that they represent. (HAND_SIZE will be a global constant, typically 5, but your program must still work if it is set to something other than 5.) Poker hands are categorized according to the following hand-types: Straight flush, four of a kind, full house, straight, flush, three of a kind, two pairs, pair, high card. To simplify the program we will ignore card suits, and face cards. The values that the user inputs will be integer values from LOWEST_NUM to HIGHEST_NUM. (These will be global constants. We'll use LOWEST_NUM = 2 and HIGHEST_NUM = 9, but your program must work if these are set to something different.) When your program runs it should start by collecting HAND_SIZE integer values from the user and placing the integers into an array that has HAND_SIZE elements. It might look like this: Enter 5 numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card…arrow_forwardIn Python, with use of function and input parsing/ Make 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.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