File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed
test/java/kyu8/areYouPlayingBanjo Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ Kata Found realized
24
24
25
25
- [ All Star Code Challenge #18 ] ( allStarCodeChallenge18 )
26
26
27
+ - [ Are You Playing Banjo?] ( areYouPlayingBanjo )
28
+
27
29
- [ Find Nearest square number] ( findNearestSquareNumber )
28
30
29
31
Original file line number Diff line number Diff line change
1
+ package kyu8 .areYouPlayingBanjo ;
2
+
3
+ public class Banjo {
4
+ public static String areYouPlayingBanjo (String name ) {
5
+ if (name .toLowerCase ().charAt (0 ) == 'r' ) {
6
+ return name + " plays banjo" ;
7
+ } else {
8
+ return name + " does not play banjo" ;
9
+ }
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ # Are You Playing Banjo?
2
+
3
+ Create a function which answers the question "Are you playing banjo?".
4
+ If your name starts with the letter "R" or lower case "r", you are playing banjo!
5
+
6
+ The function takes a name as its only argument, and returns one of the following strings:
7
+
8
+ ``` java
9
+ name + " plays banjo"
10
+ name + " does not play banjo"
11
+ ```
12
+
13
+ Names given are always valid strings.
Original file line number Diff line number Diff line change
1
+ package kyu8 .areYouPlayingBanjo ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+
5
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
6
+
7
+ public class testBanjo {
8
+ @ Test
9
+ public void PeopleThatPlayBanjo () {
10
+ assertEquals ( "Martin does not play banjo" , Banjo .areYouPlayingBanjo ("Martin" ));
11
+ assertEquals ( "Rikke plays banjo" , Banjo .areYouPlayingBanjo ("Rikke" ));
12
+ assertEquals ( "rolf plays banjo" , Banjo .areYouPlayingBanjo ("rolf" ));
13
+ assertEquals ( "bravo does not play banjo" , Banjo .areYouPlayingBanjo ("bravo" ));
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments