I need help to the answer on the Parking Fee Task with explanation. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help to the answer on the Parking Fee Task with explanation.

Help me

6th Apr 2021, 9:46 PM
Ayoboyede Adebesin
3 Answers
+ 3
First case should be hours<=5 not <=1 And multyplied by 1.00 I think? Not 0.5 And for the last case, you need all full days (24h) * 15 plus the hours longer the last 24h * 0.5 Example 50 hours = 2 * 24h + 2h => 2 * 15 + 2 * 0.5
6th Apr 2021, 10:29 PM
Coding Cat
Coding Cat - avatar
+ 1
show your attempt.
6th Apr 2021, 9:50 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
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) }
6th Apr 2021, 9:56 PM
Ayoboyede Adebesin