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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

25th Apr 2021, 8:06 PM
KEVIN MEJIA
KEVIN MEJIA - avatar
4 Answers
+ 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
25th Apr 2021, 9:28 PM
Coding Cat
Coding Cat - avatar
+ 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....
25th Apr 2021, 9:05 PM
Coding Cat
Coding Cat - avatar
+ 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 😉
25th Apr 2021, 9:37 PM
Coding Cat
Coding Cat - avatar
+ 2
At last put all together This one should do it: https://code.sololearn.com/cIIjijD1fIbS/?ref=app
25th Apr 2021, 9:53 PM
Coding Cat
Coding Cat - avatar