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)) }
4 Respostas
+ 3
Your "else" branch is wrong. Read the text more carefully. The 50$ limit is for the shipping fee, not for the total amount.
+ 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.
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))
}
0
I fix it but i dont know what ami doing wrong