public static void Main(string[] args) { Queue pQueue = new Queue(); pQueue.Enqueue(new Patient() { FirstName = "John", LastName = "Doe", Symptoms = new string[] { "Cough", "Fever" } }); pQueue.Enqueue(new Patient() { FirstName = "Jane", LastName = "Robbinson", Symptoms = new string[] { "Stomach Pain" } }); pQueue.Enqueue(new Patient() { FirstName = "Billy", LastName = "Bob", Symptoms = new string[] { "Cough", "Cold" } }); PatientModel.SetCurrentPatient((Patient)pQueue.Peek()); int userInput; do { userInput = DisplayMenu(pQueue); if (userInput == 1) { DisplayCurrentPatient(); } else if (userInput == 2) { if (CanProcessNextPatient(pQueue)) { ProcessNextPatient(pQueue); } else { Console.WriteLine("|--------------------------------------------------------"); Console.WriteLine("\tNo Patients left in Queue"); Console.WriteLine("|--------------------------------------------------------"); Console.ReadLine(); } } } while (userInput != 3); }
public static void ProcessNextPatient(Queue queue) { queue.Dequeue(); if (CanProcessNextPatient(queue)) { PatientModel.SetCurrentPatient((Patient)queue.Peek()); Patient newPatient = PatientModel.GetCurrentPatient(); Console.WriteLine("|--------------------------------------------------------"); Console.WriteLine("\tPatients in Queue: [{0}]", queue.Count); Console.WriteLine("\tNew Patient is: {0}", newPatient.FirstName + " " + newPatient.LastName); Console.WriteLine("|--------------------------------------------------------"); Console.WriteLine("\tPress any key to continue..."); } else { Console.WriteLine("|--------------------------------------------------------"); Console.WriteLine("\tNo Patients left in Queue"); Console.WriteLine("|--------------------------------------------------------"); } Console.ReadLine(); }