Exemple #1
0
 public double GanarPasta(double ganancias)
 {
     if (ganancias > 0)
     {
         return(ganancias * Beneficios / 100);
     }
     else
     {
         Directivo d = this;
         d--;
         return(0);
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Directivo        d  = new Directivo("Alberto", "Paz García", "39492832", 23, "Horno de almas", 666);
            Empleado         e  = new Empleado("Pablo", "Blanco", "34629323", 20, 200, "636363636");
            EmpleadoEspecial es = new EmpleadoEspecial("Sergio", "Martin", "12312312", 20, 2000, "363636363");

            var menu        = new Menu.Menu(new String[] { "Visualizar datos directivo", "Visualizar datos empleado", "Visualizar datos empleado especial", "Salir" });
            var menuPainter = new ConsoleMenuPainter(menu);

            int  choice = -1;
            bool picked = false;

            while (choice != 3)
            {
                menuPainter.Paint(0, 0);
                var keyInfo = Console.ReadKey();

                switch (keyInfo.Key)
                {
                case ConsoleKey.UpArrow: menu.moveUp(); break;

                case ConsoleKey.DownArrow: menu.moveDown(); break;

                case ConsoleKey.Enter:
                    choice = menu.selectedIndex;
                    picked = true;
                    Console.ResetColor();
                    break;
                }

                if (picked)
                {
                    switch (choice)
                    {
                    case 0: mostrarDatos(d);    goto default;

                    case 1: mostrarDatos(e);    goto default;

                    case 2: mostrarDatos(es);   goto default;

                    default:
                        picked = !picked; Console.Clear(); break;
                    }
                }
            }
        }