Hackerrank – Popis problému
Celý popis zadania sa nacháza – Hackerrank.
Riešenie
Vytvoril som riešenie v týchto programovacích jazykoch:
Všetky riešenia sú dostupné aj na mojom GitHub profile.
Java
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.util.*; import java.text.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double payment = scanner.nextDouble(); scanner.close(); NumberFormat usFormat = NumberFormat.getCurrencyInstance(Locale.US); NumberFormat cnFormat = NumberFormat.getCurrencyInstance(Locale.CHINA); NumberFormat frFormat = NumberFormat.getCurrencyInstance(Locale.FRANCE); NumberFormat inFormat = NumberFormat.getCurrencyInstance(new Locale("en", "in")); String us = usFormat.format(payment); String india = inFormat.format(payment); String france = frFormat.format(payment); String china = cnFormat.format(payment); System.out.println("US: " + us); System.out.println("India: " + india); System.out.println("China: " + china); System.out.println("France: " + france); } } |