public Cheese(CheeseKind kind, CheeseFatness fatness, CheeseCover cover) : base() { this.Kind = kind; this.Fatness = fatness; this.Cover = cover; this.storeAction = new StoreCheese(); this.costCalculator = new CheeseCostCalculator(this); }
private CheeseKind CreateCheeseKind(string description) { if (CheeseKindsDict.ContainsKey(description)) return CheeseKindsDict[description]; else { string[] args = description.Split(new char[] { ' ' }); if (args.Length != 2) throw new ArgumentException(); string name = args[0]; decimal cost; if (decimal.TryParse(args[1], out cost)) { CheeseKind cheeseKind = new CheeseKind(name, cost); CheeseKindsDict.Add(description, cheeseKind); return cheeseKind; } else throw new ArgumentException(); } }