diff --git a/exercises/practice/bob/src/main/kotlin/Bob.kt b/exercises/practice/bob/src/main/kotlin/Bob.kt index f15ec660..6c1ad0ee 100644 --- a/exercises/practice/bob/src/main/kotlin/Bob.kt +++ b/exercises/practice/bob/src/main/kotlin/Bob.kt @@ -1,5 +1,26 @@ object Bob { fun hey(input: String): String { - TODO("Implement the function to complete the task") + //TODO("Implement the function to complete the task") + + var response = "" + + if (input.last() == '?'){ + response = "Sure." + } + else { + for (elt in input){ + if (elt.isUpperCase()) { + response = "Whoa, chill out!" + } else if(elt.isUpperCase() && input.last() == '?'){ + response = "Calm down, I know what I'm doing!" + } else if (input.isEmpty() || input.isBlank()) { + response = "Fine. Be that way!" + } else { + response = "Whatever" + } + } + + } + return response } }