Beispiel #1
0
        /// <summary>
        /// Implemente uma classe Televisão que tenha métodos para ligar e
        /// desligar, aumentar ou diminuir o volume(com mínimo de 0 e máximo de 100) e
        /// subir ou baixar o canal(entre 1 e 83).
        /// </summary>
        public void Ex09_08_3()
        {
            Television television = new Television();
            string     op         = "";
            int        s;

            while (op != "S")
            {
                Console.Clear();
                Console.WriteLine("on or ON - Turn on the television.");
                Console.WriteLine("off or OFF - Turn off the television.");
                Console.WriteLine("ic or IC - Increase the channel.");
                Console.WriteLine("dc or DC - Decrease the channel.");
                Console.WriteLine("iv or IV - Increase the volume.");
                Console.WriteLine("dv or DV - Decrease the volume.");
                Console.WriteLine("s or S - Exit.");
                Console.WriteLine();
                Console.WriteLine(television);
                Console.WriteLine();
                Console.Write("Option: ");
                op = Console.ReadLine().ToUpper();
                switch (op)
                {
                case "ON":
                    television.TurnOn();
                    break;

                case "OFF":
                    television.TurnOff();
                    break;

                case "IC":
                    television.IncreaseChannel();
                    break;

                case "DC":
                    television.DecreaseChannel();
                    break;

                case "IV":
                    television.IncreaseVolume();
                    break;

                case "DV":
                    television.DecreaseVolume();
                    break;

                case "S":
                    break;

                default:
                    Console.WriteLine("Invalid Option.");
                    break;
                }
            }
        }