+ 1
failed kotline lesson 17
I failed in cases 5, 6 and 3 and I can't see where I was wrong because I don't have sololearn pro Does anyone know what I was wrong about or how to fix it? here I leave the code: fun main() { var hours = readLine()!!.toDouble() var total = 0.0 if(hours >= 24){ total += 15 hours -= 24 if (hours > 0){ total += hours * 0.5 } }else if (hours >= 5){ total += 5 hours -= 5 if (hours > 0){ total += hours * 0.5 } }else if (hours < 5){ while (hours > 0 ){ total += 1 hours -= 1 } } println(total) }
2 Answers
+ 1
The problem might be with:
if(hours >= 24)
The task says "each 24 hours is a flat rate of $15". If you have 48 hours = $30, 75 hours = $46.50 and so on.
+ 1
Thanks