public Wheat(WheatGrade grade, WheatHardness hardness) : base() { this.Grade = grade; this.Hardness = hardness; this.storeAction = new StoreWheat(); this.costCalculator = new WheatCostCalculator(this); }
private WheatGrade CreateWheatGrade(string description) { if (WheatGradesDict.ContainsKey(description)) return WheatGradesDict[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)) { WheatGrade wheatGrade = new WheatGrade(name, cost); WheatGradesDict.Add(description, wheatGrade); return wheatGrade; } else throw new ArgumentException(); } }