0

Help: Kotlin project - Parking fee

Tried various solutions to this project but only get half of hints unlocked. 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 Explanation: The first 5 hours are billed at $1/hour, which results in $5. After that, the next 3 hours are billed at $0.5/hour = $1.5. So, the total would be $5+$1.5 = $6.5 My attempt: https://code.sololearn.com/cgZ3u3u2xqXO

30th Jun 2022, 10:50 PM
Habibu Mamudu
Habibu Mamudu - avatar
5 Respostas
+ 2
Glad to hear it!
1st Jul 2022, 12:39 AM
Justice
Justice - avatar
+ 1
What is your attempt?
30th Jun 2022, 11:07 PM
Justice
Justice - avatar
+ 1
Habibu Mamudu 🇬🇭 Which output you are getting wrong? Because what I'm testing is pretty good so far, so I would need something more specific.
30th Jun 2022, 11:33 PM
Justice
Justice - avatar
30th Jun 2022, 11:22 PM
Habibu Mamudu
Habibu Mamudu - avatar
0
It was out 4. But found a sample elsewhere and referenced it and it working now. The modified solution https://code.sololearn.com/cOm3sH2Z6144
1st Jul 2022, 12:32 AM
Habibu Mamudu
Habibu Mamudu - avatar