Click Here! Desarrollar el siguiente ejercicio aplicando herencia Desarrollar el siguiente ejercicio. | Programacion orientada a objetos

Gana dinero por compartir tus enlaces!
Click Here! Click Here!

Desarrollar el siguiente ejercicio aplicando herencia Desarrollar el siguiente ejercicio.


Desarrollar el siguiente ejercicio aplicando herencia

Desarrollar el siguiente ejercicio.


a. Se busca conocer el nombre del profesor que enseña español. Realiza el ingreso
de tres diferentes tipos de carrera.

solución 

//Clase #1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.Windows.Forms;

namespace Taller010Applicacion2
{
    class Persona
    {
      private  string nombre;
      private  string domicilio;
      private  string horario;

        public string Nombre
        {
            get{return nombre;}
            set{nombre = value;}
        }
        public string Domicilio
        {
            get { return domicilio; }
            set { domicilio = value; }
        }
        public string Horario
        {
            get{return horario;}
            set{horario = value;}
        }
        public void asistir()
        {
            //Instrucciones deseadas
        }
    }
}
Click Here!                                                                    Descargar Proyecto       
//Clase #2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.Windows.Forms;


namespace Taller010Applicacion2
{
    class Empleado : Persona
    {
      private  string jefe;

        public string Jefe
        {
            get { return jefe; }
            set { jefe = value; }
        }

        public void cobrar()
        {
//Instrucciones deseadas
        }
    }
}
                                                                   Descargar Proyecto           
//Clase #3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Taller010Applicacion2
{
    class Estudiante:Persona
    {
       private string grado;
       private  string grupo;

        public string Grado
        {
            get{return grado;}
            set{grado = value;}
        }

        public string Grupo
        {
            get{return grupo;}
            set{grupo = value;}
        }
      
        public void estudiar()
        {
         //instruciones deseadas
        }
    }
}
//Clase #4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Taller010Applicacion2
{
    class Administrador:Empleado
    {
       private string puesto;

        public string Puesto
        {
            get{return puesto;}
            set{puesto = value;}
        }
       
        public void administrar()
        {
       //instruciones deseadas
        }
    }
}
                                                                    Descargar Proyecto   
//Clase #5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace Taller010Applicacion2
{
    class Profesor : Empleado
    {
       private string carrera;

        public string Carrera
        {
            get{return carrera;}
            set{carrera = value;
            }
        }
       
        public void enseñar()
        {
            //instruciones deseadas
        }
    }
}

Luego procedemos a crear el from


Por ultimo el código del from

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Taller010Applicacion2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Profesor profesor1 = new Profesor();
            Profesor profesor2 = new Profesor();
            Profesor profesor3 = new Profesor();
            profesor1.Nombre = "jose viveros";
            profesor1.Carrera = "Matematicas";
            profesor2.Nombre = "jailer valencia";
            profesor2.Carrera = "Español";
            profesor3.Nombre = "Juan Carlos";
            profesor3.Carrera = "Programacion Poo";
            label1.Text =
            ("Nombre : " + profesor1.Nombre + "   Carrera : " + profesor1.Carrera)+
            ("\nNombre : " + profesor2.Nombre + "   Carrera : " + profesor2.Carrera)+
            ("\nNombre : " + profesor3.Nombre + "   Carrera : " + profesor3.Carrera);
            label2.Text = ("\n\nEl Profesor que enseña Español es : " + profesor2.Nombre);
        }
    }
}
                         
                                                                 Descargar Proyecto



SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
Click Here!
Click Here!
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario