-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathSolution.java
More file actions
24 lines (18 loc) · 795 Bytes
/
Solution.java
File metadata and controls
24 lines (18 loc) · 795 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
// Problem: https://www.hackerrank.com/challenges/java-currency-formatter
// Difficulty: Easy
// Score: 15
import java.text.NumberFormat;
import java.util.Locale;
import java.util.Scanner;
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.
System.out.println("US: " + NumberFormat.getCurrencyInstance(Locale.US).format(payment));
System.out.println("India: " + NumberFormat.getCurrencyInstance(new Locale("en", "IN")).format(payment));
System.out.println("China: " + NumberFormat.getCurrencyInstance(Locale.CHINA).format(payment));
System.out.println("France: " + NumberFormat.getCurrencyInstance(Locale.FRANCE).format(payment));
}
}