0

Kotlins ...parking fee

fun main(args: Array<String>) { var hours = readLine()!!.toDouble() //var total: Double = 0.0 if (hours <= 5){ println(hours) } else if (hours >5 && hours<= 24){ println(5+(hours-5)*0.5) } else println(15+ (hours-24)*0.5 ) } I tried this code and it’s not working ,..I don’t know what I am missing..pls help me out

8th Aug 2021, 8:24 PM
Ejeh Wayne
Ejeh Wayne - avatar
2 odpowiedzi
0
Simba u should just leave what u see
9th Aug 2021, 11:16 AM
Ejeh Wayne
Ejeh Wayne - avatar
0
You have "//" at the beginning, removing the double (you need all the answers as a double - so make sure all your multipliers are with a "."). Also, why not use a "when" instead of "if, else if"?
27th Nov 2021, 8:40 PM
Ausgrindtube
Ausgrindtube - avatar