Zero Argument Constructor
Load product database with two sample products
products = new Hashtable();
// Red Hat Linux
products.put("A358185", new Double (54.99));
// McAfee PGP Personal Privacy
products.put("A358565", new Double (19.99));
Provides Current Price for requested SKU
In a real-setup, this method would connect to
a price database. If SKU is not found, method
will throw a PriceException.
Double price = (Double) products.get(sku);
if (price == null) {
throw new ProductNotFoundException ("SKU: "+sku+" not found");
}
return price.doubleValue();