0

I got the error Process killed , because it ran longer than 10 seconds when i ran the code below .Please Help me

fun shippingCost(amount: Double, international: Boolean): Double { var fee : Double = 0 if(international){ if(amount * 0.15 > 50){ fee = 50 }else fee = amount * 0.15 }else { if(amount >= 75 ){ fee = 0.0 }else fee = 0.1 * amount } return fee } fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }

24th Feb 2021, 10:22 AM
Chiến Nguyễn Ngọc
Chiến Nguyễn Ngọc - avatar
2 Respuestas
+ 7
Your code has two errors: line 3 & 6. 3: var fee : Double = 0.0 6: fee = 50.0 Fixing those and it ran fine. Sometimes SoloLearn times out and gives a random error that vanishes on rerun.
25th Feb 2021, 3:59 AM
John Wells
John Wells - avatar
0
Oh yeah ! Thank you very much.
25th Feb 2021, 4:14 AM
Chiến Nguyễn Ngọc
Chiến Nguyễn Ngọc - avatar