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 CheeseFatness CreateCheeseFatness(string description) { if (CheeseFatnessesDict.ContainsKey(description)) return CheeseFatnessesDict[description]; else { string[] args = description.Split(new char[] { ' ' }); if (args.Length != 2) throw new ArgumentException(); int value; decimal cost; if (int.TryParse(args[0], out value) && decimal.TryParse(args[1], out cost)) { CheeseFatness cheeseFatness = new CheeseFatness(value, cost); CheeseFatnessesDict.Add(description, cheeseFatness); return cheeseFatness; } else throw new ArgumentException(); } }