Pr | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Pr

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 ...... //Kotlin Compiler version 1.1.2 //do not place package here, no need fun main(args: Array<String>) { var i = readLine()!!.toInt() var g =15.0 var ff = i*1.0 var mtf = ((i-24)*0.5+15.0) var pp =(i-5)*(0.5)+5.0 var lf=i*1.0 if(i>5 && i<24) {

24th Jul 2021, 11:02 PM
Mukhtaruvich
Mukhtaruvich - avatar
1 Answer
0
Mukhtaruvich Incomplete code. Make code in Code Playground and share the link here so we can debug your problem.
25th Jul 2021, 5:54 AM
A͢J
A͢J - avatar