private void btnEvaluate_Click(object sender, EventArgs e) { var prices = new List <int>(); int price; string[] rawParts = txtPrices.Text.Split(new char[] { ',' }); foreach (string rawPart in rawParts) { var part = rawPart.Trim(); if (int.TryParse(rawPart, out price)) { prices.Add(price); } } var evaluator = new ProfitEvaluator(); int maxProfit = evaluator.GetMaxProfit(prices.ToArray()); MessageBox.Show($"Max profit possible: {maxProfit}"); }
public void Setup() { _evaluator = new ProfitEvaluator(); }