I am trying to print the result as a double and receive the following error:-
Exception in thread "main" java.lang.NumberFormatException: For input string: "kotlin.Unit"
How would I fix this?
calculateWeight(150.0).toString().toDouble()
}
fun calculateWeight(bodyWeight: Double) {
val mercury = bodyWeight * 0.38
val venus = bodyWeight * 0.91
val earth = bodyWeight * 1.00
val mars = bodyWeight * 0.38
val jupiter = bodyWeight * 2.34
val saturn = bodyWeight * 1.06
val uranus = bodyWeight * 0.92
val neptune = bodyWeight * 1.19
val pluto = bodyWeight * 0.06
println("My body weight is $bodyWeight pounds and on the different planets it equals:\n" +
"Mercury: $mercury, \nVenus: $venus, \nEarth: $earth, " +
"\nMars: $mars, \nJupiter: $jupiter, \nSaturn: $saturn, \nUranus: $uranus," +
"\nNeptune: $neptune, \nPluto: $pluto")