- 1
Suggestions on errors?
Doesnt work for a couple of tests..not sure where the mistake is fun main(args: Array<String>) { var hours = readLine()!!.toDouble() var total: Double = 0.0 total = when { hours in 0.1..5.0 -> 1.0 * hours hours in 5.1..24.0 -> ((hours-5.0)*0.5)+5.0 else -> 15.0+((hours-24.0)*0.5) } println(total) } Any help will be greatly appreciated
2 odpowiedzi
+ 2
24 hours = 14.50 in your code should be 15.0
48 hours = 27.0 should be 30.0
+ 1
that's great. thanks for the help guys.