Kotlin Parking Fee Project
My code is a little hard to read but it works with all test cases except 6, can someone tell me whats wrong with it? 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. fun main(args: Array<String>) { var hours = readLine()!!.toInt() var total: Double = 0.0 var x = hours-5 if (hours>=24) {var y = (((hours-(hours%24))/24)) var z = ((((hours-(y*24)))/2)) total += (y*15)+z} if (hours>=5 && hours <=24) {total += (x*0.5)+5} if (hours<5) {total += hours} println(total) }