Instructions:
Create a function which answers the question “Are you playing banjo?”.
If your name starts with the letter “R” or lower case “r”, you are playing banjo!
The function takes a name as its only argument, and returns one of the following strings:
name + " plays banjo"
name + " does not play banjo"
Sample Tests:
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class BanjoExampleTest {
@Test
public void PeopleThatPlayBanjo() {
assertEquals( "Nope!" , Banjo.areYouPlayingBanjo("Martin"), "Martin does not play banjo");
assertEquals( "Nope!" , Banjo.areYouPlayingBanjo("Rikke"), "Rikke plays banjo");
}
}
Solution
public class Banjo {
public static String areYouPlayingBanjo(String name) {
// Program me!
}
}