0

KOTLIN

fun main(args: Array<String>) { var hours = readLine()!!.toDouble() //var total: Double = 0.0 if (hours <= 5){ println(hours) } else if (hours >5 && hours<= 24){ println(5+(hours-5)*0.5) } else println(15+ (hours-24)*0.5 ) } Pls help me out.. my parking fee project is not working..I don’t know what I am missing

8th Aug 2021, 8:25 PM
Ejeh Wayne
Ejeh Wayne - avatar
7 ответов
+ 1
Please write text of problem and don't write code, please throw link of code
8th Aug 2021, 8:51 PM
Roma Butaku
Roma Butaku - avatar
+ 1
Ejeh Wayne , before i want to see your attempt
8th Aug 2021, 9:20 PM
Roma Butaku
Roma Butaku - avatar
0
Roma Butaku 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 here is the question hint:: The output should be a Double, even if the amount is a round number.
8th Aug 2021, 8:53 PM
Ejeh Wayne
Ejeh Wayne - avatar
0
You can see my code to understand what you do wrong, if you don't understand i can explain Error in last else statement, number of days can be more than one https://code.sololearn.com/c2k271Z1zOtu/?ref=app
8th Aug 2021, 8:58 PM
Roma Butaku
Roma Butaku - avatar
0
@ thanks alot...i really do appreciate ,..i figured it out now,..all thanks to you
8th Aug 2021, 9:06 PM
Ejeh Wayne
Ejeh Wayne - avatar
0
Roma Butaku can you help me out with the shipping calculator?...it confusing
8th Aug 2021, 9:07 PM
Ejeh Wayne
Ejeh Wayne - avatar
0
Roma Butaku Dont worry i have figure out my mistakes,.. am done with it thank you roma
8th Aug 2021, 9:22 PM
Ejeh Wayne
Ejeh Wayne - avatar