about | help | code help+videos | done | prefs |
String addQuotes(String str): Given an input string, put single quotes around words or phrases that someone is speaking. Words or phrases that should be quoted will follow the words say, says, said and continue up to and include the first punctuation mark (indicating the end of a sentence, e.g. periods, question marks, exclamation points). Assume that the "say" words are all followed by 2 characters: a comma and a single space. HINT: See the Strings Help section "Special Characters" for how to add/insert quotation marks into a string. "\'" is how you write a string containing one character, the single quote. You may also want to write a helper function to find the punctuation mark that indicates the end of the quote. RUBRIC: It is not enough to just solve the problem. Make sure you use PROPER INDENTATION. You MUST use CURLY BRACKETS for all loops and if/else statements. Also, the more EFFICIENT your solution, the higher your grade. If you have extraneous (superfluous / unnecessary) code, deductions will be taken. addQuotes("He said, goodbye. Then he left.") → "He said, 'goodbye.' Then he left." addQuotes("He thought to decline. Instead he said, All right! Everything was OK.") → "He thought to decline. Instead he said, 'All right!' Everything was OK." addQuotes("He says, Join the club! Why not?") → "He says, 'Join the club!' Why not?" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 20
Copyright Nick Parlante 2017 - privacy