+ 5

(SOLVED) Kotlin Project - Parking Fee

So my code passes every test, except one, and it is hidden. Task: You are making a car parking software that needs to calculate and output the amount due based on the number of hours the car was parked. The fee is calculated based on the following price structure: - the first 5 hours are billed at $1 per hour. - after that, each hour is billed at $0.5 per hour. - for each 24 hours, there is a flat fee of $15. This means, that, for example, if a car parked for 26 hours, the bill should be 15+(2*0.5) = 16.0, because it was parked for 24 hours plus 2 additional hours. Sample Input: 8 Sample Output: 6.5 My attempt: https://code.sololearn.com/cbFYNiXRiTOG

5th Jun 2022, 12:02 PM
🇺🇦 GUMBALL 🇺🇦 [Dead account]
2 Respuestas
+ 9
🇺🇦 GUMBALL 🇺🇦 I don't believe you are handling hours <=5 correctly. total = 0 total = hours * 5 So if I stay for 4 hrs, it will cost me $20
5th Jun 2022, 12:21 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 5
Rik Wittkopp whoops! Thank you!
5th Jun 2022, 12:22 PM
🇺🇦 GUMBALL 🇺🇦 [Dead account]