OK, here is what I am working with.
So to make sure I know what is going on, I changed
output = decimalFormat.format( Math.PI );
to
output = decimalFormat.format( decimalPlaces );
The program is displaying the number of zeros that the user inputs.
The program is also displaying the input number to the left of the decimal.
Is this just because the new decimal format has not been used to set the decimal place of any other variable yet?
I guess my question is that I do not understand how the actual number that the user inputs is being assigned to the left of the decimal.
DecimalFormat uses
patterns.
In the code that you posted, the pattern is "#.".
So the # is the number that the user enters.
Is that right?
How do I use this to apply it to a sum of two fractions or something similar?
I am wanting to be able to let a user input two rational numbers (two numerators and two denominator), and enter the number of decimal places they prefer to see. Then the user can add, subtract, multiply, or divide the two fractions. I have everything working except for this part. I just want to understand how this works. Sorry for all the questions.
Thanks,
J