-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJava Currency Formatter.java
More file actions
26 lines (21 loc) · 997 Bytes
/
Java Currency Formatter.java
File metadata and controls
26 lines (21 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
Locale INDIA = new Locale("en", "IN");//Creates a new Locale with English as the language and India as teh country
String us = NumberFormat.getCurrencyInstance(Locale.US).format(payment);
String india = NumberFormat.getCurrencyInstance(INDIA).format(payment);
String china = NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment);
String france = NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment);
System.out.println("US: " + us);
System.out.println("India: " + india);
System.out.println("China: " + china);
System.out.println("France: " + france);
}
}