private static void checkOtherClass(Plane plane, ref int choice, bool firstClass, ref bool full) { Console.WriteLine("\nSorry, this class is full! Do you wish be realocated to another class?"); Console.WriteLine("Press 1 if YES or 2 if NO"); choice = 0; if (int.TryParse(Console.ReadLine(), out choice)) { switch (choice) { case YES: full = plane.registerPlace(!firstClass); string msg = full ? ALL_FULL : THANKS_MSG; print(msg); break; case NO: Console.WriteLine("Next fligth leaves in 3 hours\n\n"); break; default: Console.WriteLine("Please, type 1 or 2 only"); break; } } }
private static int processRegister(Plane plane, int choice, bool firstClass) { bool full = plane.registerPlace(firstClass); if (full) { checkOtherClass(plane, ref choice, firstClass, ref full); } else { print(THANKS_MSG); } return(choice); }
private static int processRegister(Plane plane, int choice, bool firstClass) { bool full = plane.registerPlace(firstClass); if (full) { checkOtherClass(plane, ref choice, firstClass, ref full); } else { print(THANKS_MSG); } return choice; }