I am able to format the currencies of US and India. I have tried the few implementations using the Localebuilder ,Can anyone please explain what ia m missing.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.text.NumberFormat;
import java.util.Locale;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
// Write your code here.
NumberFormat us = NumberFormat.getCurrencyInstance(Locale.US);
System.out.println("US: " + us.format(payment));
Locale indiaa = new Locale("en", "IN");
NumberFormat india = NumberFormat.getCurrencyInstance(indiaa);
System.out.println("India: " + india.format(payment));
Locale chinaLocale = new Locale.Builder().setLanguage("zh").setRegion("CN").build();
NumberFormat china = NumberFormat.getCurrencyInstance(chinaLocale);
System.out.println("China: " + china.format(payment));
NumberFormat france = NumberFormat.getCurrencyInstance(Locale.FRANCE);
System.out.println("France: " + france.format(payment));
}
}
The Output I am getting
US: $12,324.13
India: Rs.12,324.13
China: ?12,324.13
France: 12?324,13 ?
Expected Output
US: $12,324.13
India: Rs.12,324.13
China: ¥12,324.13
France: 12 324,13 €
I am still a beginner Thanks in Advance