public static ProductsInfo getInstance() { if (instance == null) { instance = new ProductsInfo(); } return(instance); }
static void InitProducts() { ProductsInfo.getInstance().AddProductInfo("A", 10.0); ProductsInfo.getInstance().AddProductInfo("B", 20.0); ProductsInfo.getInstance().AddProductInfo("C", 30.0); ProductsInfo.getInstance().AddProductInfo("D", 40.0); ProductsInfo.getInstance().AddProductInfo("E", 50.0); ProductsInfo.getInstance().AddProductInfo("F", 60.0); ProductsInfo.getInstance().AddProductInfo("G", 70.0); ProductsInfo.getInstance().AddProductInfo("H", 80.0); ProductsInfo.getInstance().AddProductInfo("I", 90.0); ProductsInfo.getInstance().AddProductInfo("J", 100.0); ProductsInfo.getInstance().AddProductInfo("K", 110.0); ProductsInfo.getInstance().AddProductInfo("L", 120.0); ProductsInfo.getInstance().AddProductInfo("M", 130.0); }
public IProduct CreateProduct(String nameProduct) { ProductInfo pi = ProductsInfo.getInstance().GetProductInfo(nameProduct); return(new Product(pi.name, pi.cost)); }