// executes the option according to chosen state public void ExecuteOption(EzySystem ezySystem) { if (_state == 0) // go to previous menu { return; } else if (_state == 1) // add a trip { Console.WriteLine("\nPlease enter the following details."); Console.Write("1) Passenger mobile number: "); string mobileNum = Console.ReadLine(); Console.Write("2) Bus Stop to queue into: "); string stop = Console.ReadLine(); Console.Write("2) Bus Service to hop into: "); string bus = Console.ReadLine(); ezySystem.EnqueueUserToBusStop(mobileNum, stop, bus); } else if (_state == 2) // go to next available event (when bus arrives to a bus stop) { // increase time first // continue increasing time until the next event is reached (i.e. bus arrives a bus stop) while (!ezySystem.GetHasEvent()) { ezySystem.IncreaseTime(); } Console.Clear(); Console.WriteLine("SIMULATION MENU- Local time is now: " + ezySystem.GetTime()); Console.WriteLine("\n0) Return to Previous Menu"); Console.WriteLine("1) Start a passenger trip"); Console.WriteLine("2) Go to next available event"); Console.Write("\nPlease enter option number: 2\n"); // after increasing the time, check the bus stop list for buses which has arrived and display all of them DisplayAllBusArrivals(ezySystem); // Ask 'God' if any user wants to hop off UserAutoHopOff(ezySystem); UserHopOffMenu(ezySystem); // Process hop on logic inside the ezySystem // Display successful user hop ons UserHopOn(ezySystem); //while (ezySystem.GetBusArrivalList().GetCount()>0) //{ // // displaying that bus X arrived at bus stop Y // Console.WriteLine(ezySystem.GetBusArrivalList().GetFirstBusArrival().GetBusName() + " has reached bus stop " + ezySystem.GetBusArrivalList().GetFirstBusArrival().GetBusStopName()); // // display passengers inside the bus // Console.WriteLine("Bus " + ezySystem.GetBusArrivalList().GetFirstBusArrival().GetBusName() + " has the following passengers: "); // edit later // // letting simulation 'God' decide which users to hop off the bus // // transferring users from the bus stop queue to the bus passenger list // // displaying the successful hopping on of passengers // // repeat this block of code (i.e. processing of bus arrival list) until all bus arrivals are processed //} Console.Write("Press any key to continue "); Console.ReadKey(); ezySystem.ResetHasEvent(); } }