Beispiel #1
0
        private static void PrintCurrentTrafficSignal()
        {
            switch (signal.signalLight)
            {
            case TrafficLightSignal.Green:
                Console.WriteLine("The signal light is Green.");
                break;

            case TrafficLightSignal.Yellow:
                Console.WriteLine("This signal light is Yellow.");
                break;

            case TrafficLightSignal.Red:
                if (signal.GetRedLightCount() == 0)
                {
                    Console.WriteLine("This signal light is Red.");
                }
                else if (signal.GetRedLightCount() == 1)
                {
                    Console.WriteLine("This signal light is still Red.");
                }
                else if (signal.GetRedLightCount() == 2)
                {
                    Console.WriteLine("This signal light is unfortunately still Red.");
                }
                break;

            case TrafficLightSignal.LeftTurnGreen:
                Console.WriteLine("This signal light is Left Turn Green.");
                break;
            }
        }