0

Kotlin chelenge "Shipping cost calculator"

Can some one help me solve 2 test in Kotlin course fun shippingCost(amount: Double, international: Boolean): Double { if(international == true ){ if(amount<50.0 ) { return 0.0 } else{ return amount/100.0*15.0 } } else{ if(amount>75.0 ) { return 0.0 } else{ return amount/100.0*10.0 } } } fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }

8th Jan 2022, 5:18 PM
Dmytro Turchyn
Dmytro Turchyn - avatar
1 Respuesta
+ 2
International is: 15% but max 50.00 national is: 10% for amount <75.00 0.00 for amount >= 75.00
8th Jan 2022, 7:19 PM
Coding Cat
Coding Cat - avatar