File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed
thinkful-string-drills-quotable Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 579579- [ The 'spiraling' box] ( the-spiraling-box " 63b84f54693cb10065687ae5 ")
580580- [ The wheat/rice and chessboard problem] ( the-wheat-slash-rice-and-chessboard-problem " 5b0d67c1cb35dfa10b0022c7 ")
581581- [ Thinkful - Number Drills: Congo warehouses] ( thinkful-number-drills-congo-warehouses " 5862e7c63f8628a126000e18 ")
582+ - [ Thinkful - String Drills: Quotable] ( thinkful-string-drills-quotable " 5859c82bd41fc6207900007a ")
582583- [ Thinking & Testing: A and B?] ( thinking-and-testing-a-and-b " 56d904db9963e9cf5000037d ")
583584- [ Thinking & Testing : Incomplete string] ( thinking-and-testing-incomplete-string " 56d9292cc11bcc3629000533 ")
584585- [ Thinking & Testing : Something capitalized] ( thinking-and-testing-something-capitalized " 56d93f249c844788bc000002 ")
Original file line number Diff line number Diff line change 1+ # [ Thinkful - String Drills: Quotable] ( https://www.codewars.com/kata/thinkful-string-drills-quotable " https://www.codewars.com/kata/5859c82bd41fc6207900007a ")
2+
3+ This function should take two string parameters: a person's name (` name ` ) and a quote of theirs (` quote ` ), and return a string attributing
4+ the quote to the person in the following format:
5+
6+ ```
7+ '[name] said: "[quote]"'
8+ ```
9+
10+ For example, if ` name ` is ` 'Grae' ` and ` 'quote' ` is ` 'Practice makes perfect' ` then your function should return the string
11+
12+ ```
13+ 'Grae said: "Practice makes perfect"'
14+ ```
15+
16+ Unfortunately, something is wrong with the instructions in the function body. Your job is to fix it so the function returns correctly
17+ formatted quotes.
Original file line number Diff line number Diff line change 1+ interface Kata {
2+ static String quotable (String name , String quote ) {
3+ return "%s said: \" %s\" " .formatted (name , quote );
4+ }
5+ }
Original file line number Diff line number Diff line change 1+ import static org .junit .jupiter .api .Assertions .assertEquals ;
2+
3+ import org .junit .jupiter .params .ParameterizedTest ;
4+ import org .junit .jupiter .params .provider .CsvSource ;
5+
6+ class QuotableTest {
7+ @ ParameterizedTest
8+ @ CsvSource (delimiter = '|' , textBlock = """
9+ Grae | Practice makes perfect | Grae said: "Practice makes perfect"
10+ Dan | Get back to work, Grae | Dan said: "Get back to work, Grae"
11+ Alex | Ruby is great fun | Alex said: "Ruby is great fun"
12+ Bethany | Yes, way more fun than R | Bethany said: "Yes, way more fun than R"
13+ Darrell | What the heck is this thing? | Darrell said: "What the heck is this thing?"
14+ """ )
15+ void sample (String n , String q , String expected ) {
16+ assertEquals (expected , Kata .quotable (n , q ));
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments