How can I make the value of double 2 decimal places? I know how to display 2 decimal places, but how to actually set the values to 2?
Example, my change below is 7.93
So it knows the dollar is 7, but for the cent, it's showing 0.9299999999999997 instead of .93
double change = 7.93; int dollar; double cent; dollar = (int)change % 1000000; cent = change - dollar; System.out.println("Dollar " + dollar); System.out.println("Cent " + cent);
Dollar 7 Cent 0.9299999999999997