Help Kotlin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help Kotlin

You are working on a eCommerce website and need to make a shipping cost calculator based on the order amount. The store uses the following cost structure: For orders in the US: - $75+ orders have free shipping - orders less than $75 have a shipping fee of 10% of the total order amount. 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. You need to complete the given shippingCost() function, which takes the order amount and a Boolean indicating whether the order is international or not, and returns the shipping cost for that order. The return amount should be a Double. Sample Input: 140.0 true (true - international orders, false - usa) Sample Output: 21.0 It's my second day learning, sorry for bad code https://code.sololearn.com/cp9TA7JKUe17/?ref=app

12th May 2021, 1:27 PM
Riki Tano
Riki Tano - avatar
3 Answers
0
Its working, but if input (199.9, true) output - 29,9850000000003 Need 29,985 How can I solve this?
12th May 2021, 9:22 PM
Riki Tano
Riki Tano - avatar
0
Where do I write it ? Main ?
13th May 2021, 5:38 AM
Riki Tano
Riki Tano - avatar
0
No, it doesn't work. Now all the answers look like 0.000, but some answers must be 0.00 and output error Thanks for your help
13th May 2021, 5:57 AM
Riki Tano
Riki Tano - avatar