This is a test program that demonstrates the class
Currency dollars = Currency.getInstance("USD");
Currency pounds = Currency.getInstance("GBP");
Currency euros = Currency.getInstance("EUR");
Currency yen = Currency.getInstance("JPY");
// This is the portfolio to display.
EquityPosition[] positions = new EquityPosition[] {
new EquityPosition("WWW", 400, "2003-01-03", dollars, 11.90,13.00),
new EquityPosition("XXX", 1100, "2003-02-02", pounds, 71.09,27.25),
new EquityPosition("YYY", 6000, "2003-04-17", euros, 23.37,89.12),
new EquityPosition("ZZZ", 100, "2003-8-10", yen, 100000,121345)
};
// Create the portfolio from these positions
Portfolio portfolio = new Portfolio(positions, new Date());
// Set the default locale using the language code and country code
// specified on the command line.
if (args.length == 2) Locale.setDefault(new Locale(args[0], args[1]));
// Now display the portfolio.
// We use a Swing dialog box to display it because the console may
// not be able to display non-ASCII characters like currency symbols
// for Pounds, Euros, and Yen.
javax.swing.JOptionPane.showMessageDialog(null, portfolio,
Locale.getDefault().getDisplayName(),
javax.swing.JOptionPane.INFORMATION_MESSAGE);
// The modal dialog starts another thread running, so we have to exit
// explictly when the user dismisses it.
System.exit(0);