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 CheeseCover CreateCheeseCover(string description) { if (CheeseCoversDict.ContainsKey(description)) return CheeseCoversDict[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)) { CheeseCover cheeseCover = new CheeseCover(name, cost); CheeseCoversDict.Add(description, cheeseCover); return cheeseCover; } else throw new ArgumentException(); } }