Kotlin Control Flow : Code Project [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Kotlin Control Flow : Code Project [Solved]

I cannot figure out why there are three hidden test cases which are rejecting my code. I tried every possible way. Code attached below: Question: 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 https://sololearn.com/compiler-playground/c5F54ciO1mxU/?ref=app

31st Dec 2023, 9:18 PM
<k>Kartik</k>
4 Answers
+ 3
<k>Kartik</k> consider how to compute the fee when the car is parked for two days or more.
31st Dec 2023, 10:54 PM
Brian
Brian - avatar
+ 2
<k>Kartik</k> , I think you fixed your code. Right? I see a big commented-out section that must have been the old code. If so, please add [Solved] to the title so people who help know they don't need to open it. I remember that task. What struck me is how much of a ripoff the day rate is for extended stay. $15 instead of $12.
2nd Jan 2024, 3:58 PM
Rain
Rain - avatar
+ 2
Rain Yes.. actually I solved it in the project playground...will copy paste here and update my question
3rd Jan 2024, 5:54 AM
<k>Kartik</k>
+ 1
Brian Thank you finally, I got the thing.
3rd Jan 2024, 5:53 AM
<k>Kartik</k>