How to give user the ability to set the decimal format rounding to whichever s/he prefers.
I know that the users input can be gained by the code
double decimalRoundTo;
Scanner input = new Scanner(System.in);
out.print(" Enter the number of decimal places you want to round to ");
decimalRoundTo = input.nextDouble();
and the programmer can set the decimal format with the code below.
out.format("%.2f", numberToBeRounded);
However, I want to give my user that ability. How would this be possible, if it is at all?