+ 1
How about, could you help me with this KOTLIN problem please. I do not know what else to do. and they can tell me that it's wron
Que tal, me podrían ayudar con este problema de KOTLIN pro favor. No se que mas hacer. y me pueden decir que está mal. https://code.sololearn.com/cr2wB6bu5ZYJ/?ref=app
4 odpowiedzi
+ 3
This is wrong:
if(international == true){
return ((total*15)/100)
if( total > 50){
return (total = 50)
}
Because if International is true, it will return the 15%. The next if statement will never reached.
Correct is:
if(international == true) {
var result = total*15/100
if( resultl > 50) {
result = 50.00
}
return result
+ 2
Can't test it. KT playground is not working for me. But what I see: You can not use "total" inside your function. Because:
fun shippingCost(amount: Double, inter....
You have to use amount instead.
Or change:
fun shippingCost(amount: Double, inter....
to:
fun shippingCost(total: Double, inter....
+ 2
Last point is only a hint, should not give an error.
Here, you don't have to check, if International == false:
else if (international == false &&....
You've check it before for true, so it must be false here 😉
+ 2
At last put all together
This one should do it:
https://code.sololearn.com/cIIjijD1fIbS/?ref=app