public void Choice(out int result) { Console.WriteLine("Enter your choice:"); try { result = Convert.ToInt32(Console.ReadLine()); if (result >= 6 || result < 0) { throw new FormatException(); } else { Todo(result); } } catch (FormatException) { result = 0; Console.Clear(); Console.WriteLine("Incorrect input, choose only from 1 to 5."); Queue.UI(); this.Choice(out result); } }
Queue <int> outsideQ = new Queue <int>(); //Queue for vehicles outside the parking slot public void QueueOperations() { int result = 5; Queue.UI(); this.Choice(out result); this.Todo(result); }