public static void Main() { var jobs = new JobsList(); var employees = new List <Employee>(); while (true) { var input = Console.ReadLine().Split(); if (input[0] == "End") { break; } switch (input[0]) { case "Job": var name = input[1]; var hours = int.Parse(input[2]); var employee = employees.FirstOrDefault(e => e.Name == input[3]); Job job = new Job(name, hours, employee); job.JobDone += job.OnJobDone; jobs.Add(job); break; case "StandardEmployee": name = input[1]; employees.Add(new StandartEmployee(name)); break; case "PartTimeEmployee": name = input[1]; employees.Add(new PartTimeEmployee(name)); break; case "Pass": jobs.ForEach(j => j.Update()); break; case "Status": foreach (var j in jobs) { if (!j.IsDone) { Console.WriteLine(j.ToString()); } } break; } } }
public static void Main() { JobsList jobs = new JobsList(); List <Employee> emploees = new List <Employee>(); string[] input = Console.ReadLine().Split(); while (input[0] != "End") { switch (input[0]) { case "Job": Job realJob = new Job(input[1], int.Parse(input[2]), emploees.FirstOrDefault(e => e.Name == input[3])); realJob.JobDone += realJob.OnJobDone; jobs.Add(realJob); break; case "StandartEmployee": emploees.Add(new StandartEmployee(input[1])); break; case "PartTimeEmployee": emploees.Add(new PartTimeEmployee(input[1])); break; case "Pass": foreach (var job in jobs) { job.Update(); } break; case "Status": foreach (var job in jobs) { if (!job.IsDone) { Console.WriteLine(job.ToString()); } } break; } input = Console.ReadLine().Split(); } }