You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.text.*;
public class Solution {
public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan = new Scanner(System.in); double payment = scan.nextDouble(); scan.close(); Locale indiaLocale = new Locale("en","IN"); NumberFormat usFormatter = NumberFormat.getCurrencyInstance(Locale.US); NumberFormat indiaFormatter = NumberFormat.getCurrencyInstance(indiaLocale); NumberFormat chinaFormatter = NumberFormat.getCurrencyInstance(Locale.CHINA); NumberFormat franceFormatter = NumberFormat.getCurrencyInstance(Locale.FRANCE); String usa = usFormatter.format(payment); String india = indiaFormatter.format(payment).replace("\u20B9", "Rs."); String china = chinaFormatter.format(payment).replace("\u00A5", "\uFFE5"); String france = franceFormatter.format(payment).replace("\u202F", "\u00A0").replace("\u00A0"," "); System.out.println("US: " + usa); System.out.println("India: " + india); System.out.println("China: " + china); System.out.println("France: " + france); }
}
i have tried the same thing here but only 2 test cases passed pls tell some solutino so tht i can get the remaining test cases passed
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 →
import java.io.; import java.util.; import java.text.*;
public class Solution {
}
i have tried the same thing here but only 2 test cases passed pls tell some solutino so tht i can get the remaining test cases passed