public Task(string input) { InputConverter convert = new InputConverter(); int[] numbers = convert.Convert(input); if (Check(numbers[0], numbers[1])) { this.worst = numbers[0]; this.best = numbers[1]; } else { Console.WriteLine("Numbers are invalid (best > avg > worst)"); throw new Exception("Invalid input"); } }
static void Main(string[] args) { int id = 1; string input; Plan plan = new Plan(); InputConverter IC = new InputConverter(); Console.WriteLine("Enter tasks in the following format: \"min, max\" (no avg needed)"); Console.WriteLine("Type END to finish entering tasks"); do { Console.Write($"Task #{id}: "); input = Console.ReadLine(); if (IC.Check(input)) { id++; plan.Add(new Task(input)); } } while (input != "END"); plan.GetStats(); Console.ReadLine(); }