Exemplo n.º 1
0
        }             // end Result

        static void Main()
        {
            // ********** Do not remove the following statement ******************
            timeTable = Timetables.CreateTimeTable();
            //*********** Start your code for Main below this line  ******************
            int    departselection, departnumber, arriveselection;
            string arrivetime;

            departselection = Departfrom();

            if (departselection == EXIT)
            {
                ExitProgram();
                return;
            }

            departnumber = Userdepartstation(departselection);

            arriveselection = Arriveat(departnumber);

            if (arriveselection == EXIT)
            {
                ExitProgram();
                return;
            }

            arrivetime = Whattimeforarrive(arriveselection);

            Result(departnumber, arriveselection, arrivetime);

            ExitProgram();
        }// end Main
Exemplo n.º 2
0
        static void Main()
        {
            // ********** Do not remove the following statement ******************
            timeTable = Timetables.CreateTimeTable();

            //*********** Start your code for Main below this line  ******************
            FindTime();

            ExitProgram();
        }// end Main
Exemplo n.º 3
0
        static void Main()
        {
            // ********** Do not remove the following statement ******************
            timeTable = Timetables.CreateTimeTable();

            //*********** Start your code for Main below this line  ******************

            TimeSpan[,] timespanTimetable = ConvertTimetableToTimeSpans(timeTable);

            // Get the starting station, exit on user request
            Stations?startingStation = GetStartingStation();

            if (startingStation == null)
            {
                ExitProgram();

                return;
            }

            // Get the ending station, exit on user request
            Stations?endingStation = GetEndingStation();

            if (endingStation == null)
            {
                ExitProgram();

                return;
            }

            // Check if journey is possible
            if (!AreStationsValid(startingStation, endingStation))
            {
                ExitProgram();

                return;
            }

            // Calculate journey
            string timePrompt = String.Format("Latest time to arrive at {0} (24-hour format):", endingStation);

            TimeSpan latestArrivalTime = LoopReadTimeSpan(timePrompt, timespanTimetable, endingStation);

            // The index of the arrival time will be the index of the departure time, with different stations
            int prevStationArrivalTimeIndex = GetStationArrivalTimeIndex(timespanTimetable, endingStation, latestArrivalTime);

            DisplayDepartureTime(timespanTimetable, latestArrivalTime, startingStation, endingStation, prevStationArrivalTimeIndex);

            ExitProgram();

            return;
        }// end Main