You are viewing a single comment's thread. Return to all comments →
try this in Java 8
double payment = scanner.nextDouble(); scanner.close(); String us=NumberFormat.getCurrencyInstance(Locale.US).format(payment); String india=NumberFormat.getCurrencyInstance(new Locale("en","IN")).format(payment); String china=NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment); String france=NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);
// Write your code here. System.out.println("US: " + us); System.out.println("India: " + india); System.out.println("China: " + china); System.out.println("France: " + france);
Seems like cookies are disabled on this browser, please enable them to open this website
Java Currency Formatter
You are viewing a single comment's thread. Return to all comments →
try this in Java 8
double payment = scanner.nextDouble(); scanner.close(); String us=NumberFormat.getCurrencyInstance(Locale.US).format(payment); String india=NumberFormat.getCurrencyInstance(new Locale("en","IN")).format(payment); String china=NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment); String france=NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);