I have this program in which I need to add up many BigDecimals. I have the following snippet of code
BigDecimal Average = new BigDecimal(3.0);
BigDecimal ATT = new BigDecimal(0.0);
ATT.add(A_BigDecimal);
ATT.add(B_BigDecimal);
ATT.add(C_FullBigDecimal);
System.out.println("Total Amount: " + ATT);
System.out.println("Average: " + ATT.divide(Average));
I keep getting errors everytime I try variants of this code, how do you add many BigDecimals together? Edit: Forgot to mention that the output is zero, always zero, as if the reference variable isnt reading the add function.