01: /*
02: @COPYRIGHT@
03: */
04: package demo.inventory;
05:
06: import demo.inventory.Department;
07: import demo.inventory.Product;
08: import java.util.ArrayList;
09: import java.util.HashMap;
10: import java.util.List;
11: import java.util.Map;
12:
13: public class Store {
14: private List departments = new ArrayList();
15: private Map inventory = new HashMap();
16:
17: public Store() {
18: Product warandpeace = new Product("War and Peace", 7.99, "WRPC");
19: Product tripod = new Product("Camera Tripod", 78.99, "TRPD");
20: Product usbmouse = new Product("USB Mouse", 19.99, "USBM");
21: Product flashram = new Product("1GB FlashRAM card", 47.99,
22: "1GFR");
23:
24: Department housewares = new Department("B", "Books",
25: new Product[] { warandpeace });
26: Department photography = new Department("P", "Photography",
27: new Product[] { tripod, flashram });
28: Department computers = new Department("C", "Computers",
29: new Product[] { usbmouse, flashram, });
30:
31: departments.add(housewares);
32: departments.add(photography);
33: departments.add(computers);
34:
35: inventory.put(warandpeace.getSKU(), warandpeace);
36: inventory.put(tripod.getSKU(), tripod);
37: inventory.put(usbmouse.getSKU(), usbmouse);
38: inventory.put(flashram.getSKU(), flashram);
39: }
40:
41: public final List getDepartments() {
42: return departments;
43: }
44:
45: public final Map getInventory() {
46: return inventory;
47: }
48: }
|