// menu which asks for user input for hopping off the bus private void UserHopOffMenu(EzySystem ezySystem) { if (ezySystem.ThereIsPassengerOnBus()) { Console.Write("Do you want to hop off passengers? (Y/N) "); string input = Console.ReadLine(); while (String.Equals(input, "Y") || String.Equals(input, "y")) { Console.WriteLine("Please select a bus stop from the list above."); string busStopName = Console.ReadLine(); Console.WriteLine("The following are the buses which arrived at the chosen bus stop. Please select one.\n"); // display all buses in the bus stop for (int i = 0; i < ezySystem.GetBusStopList().FindBusStopWithBusStopName(busStopName).GetBusQueueCount(); i++) { Console.WriteLine((i + 1) + ")" + ezySystem.GetBusStopList().FindBusStopWithBusStopName(busStopName).GetBusQueue()[i]); } string busName = Console.ReadLine(); Console.WriteLine("The following are the passengers inside this particular bus. Please select who will hop off."); // display all passengers inside the bus // where to get the passenger for (int i = 0; i < ezySystem.GetBusList().FindBusWithBusName(busName).GetPassengerList().Count; i++) { Console.WriteLine((i + 1) + ")" + ezySystem.FindUserWithMobileNumber(ezySystem.GetBusList().FindBusWithBusName(busName).GetPassengerList().ElementAt(i).GetMobileNum())); //Console.WriteLine((i + 1) + ")" + ezySystem.GetUserList().FindUserWithMobileNumber((ezySystem.GetBusStopList().FindBusStopWithBusStopName(busStopName).GetPassengerList()[i].GetMobileNum())).GetName()); } string userName = Console.ReadLine(); // remove passenger from the bus after this line ezySystem.DequeueUserFromBus(userName, busName, busStopName); // ask again if another passenger wants to hop off Console.Write("\nDo you want to hop off passengers? (Y/N) "); input = Console.ReadLine(); } } }