Beispiel #1
0
        public TP2_01() //"CONSTRUCTOR"
        {
            string bienvenida = "¡Ahora puede calcular el área y el perímetro de una de las siguientes formas geométricas!" + Environment.NewLine
                                + "Por favor ingrese un valor (con o sin coma). TODO SE CALCULA EN cm" + Environment.NewLine
                                + "*** 1: Calcular cuadrado" + Environment.NewLine
                                + "*** 2: Calcular triangulo" + Environment.NewLine
                                + "*** 3: Calcular circulo" + Environment.NewLine;

            do
            {
                Console.WriteLine(bienvenida);
                int inputNum = ResourcesFacu.pedirValorNumerico();
                switch (inputNum)
                {
                case 1:
                    new CalculoCuadrado();
                    Console.WriteLine(ResourcesFacu.getSeguirTxt());     // Tiempo muerto para ver resultado
                    a = ResourcesFacu.seguir(ResourcesFacu.pedirValorNumerico());
                    break;

                case 2:
                    new CalculoTriangulo();
                    Console.WriteLine(ResourcesFacu.getSeguirTxt());     // Tiempo muerto para ver resultado
                    a = ResourcesFacu.seguir(ResourcesFacu.pedirValorNumerico());
                    break;

                case 3:
                    new CalculoCirculo();
                    Console.WriteLine(ResourcesFacu.getSeguirTxt());     // Tiempo muerto para ver resultado
                    a = ResourcesFacu.seguir(ResourcesFacu.pedirValorNumerico());
                    break;

                default:
                    Console.WriteLine(equivocado);
                    a = true;
                    continue;
                }
            } while (a == true);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int    inputNum;
            string nuevoPrograma =
                "¿Qué programa quiere ejecutar?" + Environment.NewLine +
                "0. TP NQV (nada que ver) (el primero de todos)" + Environment.NewLine +
                "1. TP 01" + Environment.NewLine +
                "2. TP 02" + Environment.NewLine +
                "3. NINGUNO, ME QUIERO IR" + Environment.NewLine;

            string tp02 =
                "¿Qué ejercicio?" + Environment.NewLine +
                "1. Formas geométricas" + Environment.NewLine +
                "2. Daytona (de autos)" + Environment.NewLine;

            string wrong = "Ingresaste un valor inválido." + Environment.NewLine;

            string despedida = "¡Muchas gracias por jugar un rato conmigo!" + Environment.NewLine +
                               "** Presione cualquier tecla para salir.";

            bool a = false;

            do
            {
                Console.WriteLine(nuevoPrograma);
                inputNum = ResourcesFacu.pedirValorNumerico();
                switch (inputNum)
                {
                case 0:
                    Console.WriteLine();
                    TP0 tp0 = new TP0();
                    break;

                case 1:
                    Console.WriteLine(tp02);
                    inputNum = ResourcesFacu.pedirValorNumerico();
                    bool f = false;
                    do
                    {
                        switch (inputNum)
                        {
                        case 1:
                            new TP2_01();
                            f = false;
                            break;

                        case 2:
                            new TP2_02();
                            f = false;
                            break;

                        default:
                            Console.WriteLine(wrong);
                            f = true;
                            break;
                        }
                    } while (f == true);

                    Console.WriteLine(ResourcesFacu.getSeguirTxt());     // Tiempo muerto para ver resultado
                    a = ResourcesFacu.seguir(ResourcesFacu.pedirValorNumerico());
                    break;

                case 2:
                    Console.WriteLine(ResourcesFacu.getSeguirTxt());     // Tiempo muerto para ver resultado
                    a = ResourcesFacu.seguir(ResourcesFacu.pedirValorNumerico());
                    break;

                case 3:
                    Console.WriteLine(despedida);
                    a = false;
                    break;

                default:
                    Console.WriteLine(wrong);
                    a = true;
                    break;
                }
            } while (a == true);

            Console.Read(); //Tiempo muerto, antes de finalizar
        }