Monday, 9 September 2013

#EANF#

#EANF#

I can't understand why I am losing values for the below:
double bal = d.getBalance();
double finalBal = bal + (bal* x/1200*p);
BigDecimal result = new BigDecimal(finalBal).setScale(2,
BigDecimal.ROUND_HALF_UP);
System.out.println(d.getName()+" "+(result));
bal, p and x are all double type. Hence I am using the big decimal to
change it to the standard currency format. I cant understand why I am
getting more values.
Expected Output Your Output
Tom 69.28 Tom 66.54
Mickey 108.42 Mickey 105.46
Juliet 2488.71 Juliet 2495.00
Ann 2201.94 Ann 2208.19

No comments:

Post a Comment