+ 1
Can't pass the parking tree problem in kotlin
Please does anyone knows how i can pass the parking tree problem in kotlin? After passing the first and second test case, the other cases refused to open meanwhile my code is correct. Please does anyone knows what I'll do to open the remaining test cases? or maybe only sololearn pro users have access to it?
4 Respuestas
+ 1
Show us the code so we can help you. If your code were correct, it would've passed all test cases. Also, you can't open the remaining test cases for your own good.
+ 2
fun main(args: Array<String>) {
var hours = readLine()!!.toInt()
var total: Double = 0.0
if ( hours <= 1) {
total = 0.5 * hours
} else if (hours >= 5 && hours <= 23) {
total = 5.00 + (hours - 5) * 0.5
} else {
total = 15.00 + (hours - 24) * 0.5
}
println(total)
}
+ 1
Here is the code
+ 1
What happens if someone parks for 2 days or longer? The math isn't right. You'll need to calculate out all the days for the 24 hour rate. Then 0.5 for the balance.
If someone parked for 55 hours. That would be 2 days and 7 hours.