Below are my 2 functions
def getProductAsDouble(nums: Double*):Double={
var n = new BigDecimal("1.0")
nums.foreach(num => n = n.multiply(new BigDecimal(num.toString)))
n.setScale(2,java.math.BigDecimal.ROUND_HALF_UP).doubleValue()
}
def getProductAsString(nf:NumberFormat,nums: Double*): String ={
nf.format(getProductAsDouble(nums)) // shows error here
}
I am unable to pass nums
from getProductAsString
to getProductAsDouble
. Is there any way to resolve this?