0
Can anyone tell me where my mistake is?
Cannot find my mistake. The test shows that I got it right, but the hidden tests are wrong. I can't really see where some would work and others would fail if it's hidden. Thanks in advance. fun main(args: Array<String>) { var age = readLine()!!.toInt() var result = when { age >= 0 && age <= 11 -> "Child" age >= 12 && age <= 17 -> "Teenager" age >= 18 && age <= 64 -> "Adult" age >= 65 -> "Senior" else -> "Invalid Age" } println(result) }
3 odpowiedzi
+ 1
Can you please explain the problem? What are the boundaries you need?
+ 1
Disregard, I just solved it.
Apparently, the issue was that I wrote Teenager instead of "Teen" and Invalid Age instead of "Invalid age".
0
I am supposed to create the result to show up as child, teenager, adult, senior, or invalid age, depending on the number between the ranges shown (0 - 11, 12 - 17, 18 - 64, 65+, and negative numbers).
The tests show that child does show up. Adult does show up as well. However, there are two tests showing up as "wrong" and telling me to try again. Unfortunately, the tests are labeled "hidden" so I cannot see what is wrong and why it won't come up properly.