0

# Помогите решить задачу на 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. Код: fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) } fun shippingCost(total:Double, international: Boolean): Double? { var sumTotal: Double = 0.0 if (total >= 0) { if (total >= 75 && !international) { return 0.0 } else if ((total * 0.15) <= 50 && international) { return total * 0.15 } else if (total in 0.0..74.0 && !international) { return total * 0.1 } else return shippingCost(total, international) } return null }

11th Sep 2021, 9:25 AM
Борис Храмцов