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.*;publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannersc=newScanner(System.in);doublepayment=sc.nextDouble();System.out.println("US: "+NumberFormat.getCurrencyInstance(Locale.US).format(payment));System.out.println("India: "+("Rs."+NumberFormat.getCurrencyInstance(newLocale("en","IN")).format(payment).substring(1)));System.out.println("China: "+NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment).replace("\u00A5","\uFFE5"));System.out.println("France: "+NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment).replace(' ','\u00A0'));}}
For this my output and expected output is similiar, I have also checked the unicode for the symbols.
Cookie support is required to access HackerRank
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 →
I don't know, Why it shows error in this code.
For this my output and expected output is similiar, I have also checked the unicode for the symbols.