I cant get the correct output for this in kotlin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I cant get the correct output for this in kotlin

fun shippingCost(amount: Double, international: Boolean): Double{ val amount: Double= readLine()!! println("The amount is: $amount") val international =true val total: Double= when{ amount>=75.0&&international==false->amount amount<75.0&&international==false->10/100*amount+amount international==false->15/100*amount+amount else-> 0.0 } return (total) } fun main(args: Array<String>) { val total = readLine()!!.toDouble() val international = readLine()!!.toBoolean() println(shippingCost(total, international)) }

10th Feb 2022, 3:31 PM
Solomon Obonyo
Solomon Obonyo - avatar
1 Answer
+ 3
What is the reason for lines 3,4&5? Also, please double check that your conditions are matched with the given task.
10th Feb 2022, 4:11 PM
Simba
Simba - avatar