Provides support for monetary quantities and their currencies.

Conversions between quantities stated in different currencies is possible if the exchange rates for the currencies have been set (otherwise ConversionException is thrown).

Monetary quantities support the dynamic changes of the currencies exchange rates as illustrated in the following example:

    ///////////////////////////////////////////////////////////////////////
    // Calculates the cost of a car trip in Europe for an American tourist.
    ///////////////////////////////////////////////////////////////////////

    // Use currency symbols instead of ISO-4217 codes.
    Currency.USD.label("$"); // Use "$" symbol instead of currency code ("USD")
    Currency.EUR.label("€"); // Use "€" symbol instead of currency code ("EUR")

    // Calculates trip cost.
    Quantity    carMileage   = Quantity.valueOf(20, NonSI.MILE.divide(NonSI.GALLON_LIQUID_US)); // 20 mi/gal.
    Quantity    gazPrice     = Quantity.valueOf(1.2, Currency.EUR.divide(NonSI.LITER)); // 1.2 €/L
    Length      tripDistance = (Length) Quantity.valueOf(400, SI.KILO(SI.METER)); // 400 km
    Money       tripCost     = (Money) tripDistance.divide(carMileage).multiply(gazPrice);

    // Sets exchange rates.
    Currency.setReferenceCurrency(Currency.USD);
    Currency.EUR.setExchangeRate(1.17); // 1.0 € = 1.17 $

    // Displays cost.
    Money.showAs(Currency.USD);
    System.out.println("Trip cost = " + tripCost + " (" + tripCost.toString(Currency.EUR) + ")");

    > Trip cost = 66.05 $ (56.45 €)