import java.text.DecimalFormat; //DecimalFormat is discussed in //http://java.sun.com/docs/books/tutorial/java/data/decimalFormat.html public class CurrencyExchange { static double EUROS_PER_DOLLAR = 0.781162; public static void main(String[] args) { DecimalFormat formatter = new DecimalFormat("###,###.00"); double numEuros = 10000000.0; double numDollars = numEuros/EUROS_PER_DOLLAR; System.out.println(formatter.format(numEuros) + " euros is equal to $" + formatter.format(numDollars) + "."); } }