The C++ version of the currency class is RWCurrency and the Java version is Currency. Both classes store the following currency information:
Mnemonic. The mnemonic uniquely identifies the currency. Defined in the ISO 4217:1995 standard.
Name. The name uniquely identifies the currency. Defined in the ISO 4217:1995 standard.
Numeric Code. The numeric code uniquely identifies the currency. Defined in the ISO 4217:1995 standard.
Fraction Name. The name of the fraction part of the currency. Examples of fraction names are "Cents" for United States "Dollar" and "Pence" for United Kingdom "Pound".
Ratio of Whole to Fraction. Ratio between one unit of the whole part of the currency and the smallest unit of the fractional part of the currency. For United States Dollars the ratio is one dollar to one penny or 0.01.
Introduction Date. Date that the currency was (or will be) introduced.
Expiration Date. Date upon which the currency is no longer valid.
Notice that the currency information class does not contain information about the relative value of a currency to any other currency, nor does it specify any amounts. Money classes, described in Chapter 4, provide a mapping between a currency and an amount. A variety of currency exchange classes, described in Chapter 5, provide methods for converting from one currency to another.
When you construct a currency object in C++ or Java, the introduction and expiration dates are optional. For example the following line creates an RWCurrency object, USDollars:
RWCurrency USDollars("USD", 840, "dollar", "cents", 0.01);
In C++, when you omit the introduction and expiration dates they are replaced with two public static data members: RWCurrency::noIntroductionDate and RWCurrency::noExpirationDate. The data member noIntroductionDate represents a date that is before January 1, 1000. Similarly, noExpirationDate represents December 25, 9999. You can also use these data members in code to determine whether a currency object has an introduction of expiration date. The entry for RWCurrency in the class reference contains an example showing how the data members work.
In Java, when you omit the introduction and expiration dates they are replaced with data members DEFAULT_INTRODUCTION and DEFAULT_EXPIRATION.
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.