In this question I am doing, I am asked to convert an amount into the Indian numbering format and the expected output is – India: Rs.12,324.13. However, even though I converted into the Indian numbering format, the answer I got is – India: ₹12,324.13.
Scanner input = new Scanner(System.in);
double money = input.nextDouble();
NumberFormat currencyFormat2 = NumberFormat.getCurrencyInstance(new Locale("en", "IN"));
String formatted2 = currencyFormat2.format(money);
System.out.println("India: " + formatted2);
The output I get from the above code is – India: ₹12,324.13
The expected output is – India: Rs.12,324.13
I have tried the above method, but the website would not accept the output when the rupee symbol is used. Therefore I need to remove the rupee symbol and put Rs. instead. How do I fix this?
Enuthi Warawita is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.