0

can you help me what am i doing wrong

fun shippingCost(amount: Double, international: Boolean): Double { var envio=0.0 if(amount >=75 && international==false){ envio=0.0 } else if(amount<75 && international==false){ envio=(amount *10/100) } else (amount>=50 && international==true){ envio=(amount*15/100) } return envio } fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }

21st Jul 2022, 6:22 PM
ANDRES PENA
ANDRES PENA - avatar
4 ответов
+ 3
Your "else" branch is wrong. Read the text more carefully. The 50$ limit is for the shipping fee, not for the total amount.
21st Jul 2022, 6:47 PM
Tibor Santa
Tibor Santa - avatar
+ 1
For orders in the United States: - $75+ orders have free shipping - Orders under $75 have shipping costs of 10% of the total amount of the order. For international orders, there is a 15% shipping fee, with a maximum of $50. This means that the maximum shipping fee for an international order is $50.
21st Jul 2022, 6:24 PM
ANDRES PENA
ANDRES PENA - avatar
0
fun shippingCost(amount: Double, international: Boolean): Double { var envio=0.0 if(amount >=75 && international==false){ envio=0.0 } else if(amount<75 && international==false){ envio=(amount *10/100) } else if (amount *0.15 >50 && international == true){ envio = 50 } else { envio =amount *0.15 } return envio } fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }
22nd Jul 2022, 3:35 PM
ANDRES PENA
ANDRES PENA - avatar
0
I fix it but i dont know what ami doing wrong
22nd Jul 2022, 3:36 PM
ANDRES PENA
ANDRES PENA - avatar