We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.io.*;importjava.util.*;importjava.text.*;importjava.math.*;importjava.util.regex.*;publicclassSolution{publicstaticvoidmain(String[]args){Scannerscanner=newScanner(System.in);doublepayment=scanner.nextDouble();scanner.close();NumberFormatusd=NumberFormat.getCurrencyInstance(Locale.US);System.out.println("US format = "+usd.format(payment));NumberFormatinr=NumberFormat.getCurrencyInstance(newLocale("en","in"));System.out.println("India format = "+inr.format(payment));}}
Java Currency Formatter
You are viewing a single comment's thread. Return to all comments →
Am I misunderstanding how Locales work? I wasn't able to find a locale for india, and had to construct one using:
for the US, I was able to just use
My solution: