Professional Documents
Culture Documents
ertyuiopasdfghjklzxcvbnmqwert
yuiopasdfghjklzxcvbnmqwertyui
opasdfghjklzxcvbnmqwertyuiopa
Portafolio
Desarrollo de Aplicaciones
sdfghjklzxcvbnmqwertyuiopasdf
Emmanuel Quiroz Reyes
ghjklzxcvbnmqwertyuiopasdfghj
klzxcvbnmqwertyuiopasdfghjklzx
cvbnmqwertyuiopasdfghjklzxcvb
nmqwertyuiopasdfghjklzxcvbnm
qwertyuiopasdfghjklzxcvbnmqw
ertyuiopasdfghjklzxcvbnmqwert
yuiopasdfghjklzxcvbnmqwertyui
opasdfghjklzxcvbnmqwertyuiopa
sdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghj
klzxcvbnmqwertyuiopasdfghjklzx
3G
ndice
Introduccin....1
Prctica 1: Hipotenusa2 4
Prctica 2: rea y Permetro.5 8
Prctica 3: Invertir, Multiplicar e Invertir..9 14
Prctica 4: Suma y Resta.15 17
Prctica 5: Venta producto...18 20
Prctica 6: Nmeros primos.21 - 24
Prctica 7: Nmeros Pares e Impares25 - 28
Prctica 8: Controles..29 - 37
Prctica 9: Mostrar Mayores y Eliminar..38 - 42
Prctica 10: Desviacin Estndar y Varianza43 46
Unidad 2...47
Prctica 11:
Introduccin
En este documento se encontrara todo lo relacionado a lo visto en el primer parcial.
2
Prctica 1: Hipotenusa
Problemtica:
3
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace hipo
{
classTRIANGULO
{
privatedouble ca_A, ca_B;
publicdouble Cateto_1
{
get { return ca_A; }
set { ca_A = value; }
}
publicdouble Cateto_2
{
get { return ca_B; }
set { ca_B = value; }
}
public TRIANGULO()
{
ca_A = 0;
ca_B = 0;
}
public TRIANGULO(double cA,double cB)
{
ca_A = cA;
ca_B = cB;
}
publicdouble Calcular_Hipotenusa()
{
double c_A = Math.Pow(ca_A, 2);
double c_B = Math.Pow(ca_B, 2);
double sum = c_A + c_B;
double hipo = Math.Sqrt(sum);
return hipo;
}
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
namespace hipo
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
privatevoid button1_Click_1(object sender, EventArgs e)
{
TRIANGULO T_hipo = newTRIANGULO();
T_hipo.Cateto_1 = Convert.ToDouble(txtCateA.Text);
T_hipo.Cateto_2 = Convert.ToDouble(txtCateB.Text);
lblResultado.Text = " El resultado de la hipotenusa es: " + T_hipo.Calcular_Hipotenusa();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
}
}
Problemtica:
En este programa se est solicitando sacar el rea y permetro de un cuadrado, circulo y
triangulo, solicitando al usuario los datos en el tringulo la base y la altura, en el cuadrado
el lado y en el crculo el radio
Diagrama de clase
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Figuras
{
publicclassTRIANGULO
{
privatedouble bas, altura;
publicdouble Bas
{
get{return bas;}
set{bas = value;}
}
publicdouble Altura
{
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Figuras;
namespace Form_figuras
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
privatevoid label1_Click(object sender, EventArgs e)
{
}
privatevoid btnCalcular_Click(object sender, EventArgs e)
{
TRIANGULO objetT = newTRIANGULO();
CUADRADO objetCC = newCUADRADO();
CIRCULO objetCir = newCIRCULO();
objetT.Bas = Convert.ToDouble(txtBase.Text);
objetT.Altura = Convert.ToDouble(txtAltura.Text);
objetCC.Lado = Convert.ToDouble(txtLado.Text);
objetCir.Radio = Convert.ToDouble(txtRadio.Text);
lblResultadosT.Text = "El area del Triangulo es: " + objetT.Area_Triangulo() + "\n Y el
Perimetro es: " + objetT.Perimetro_Triangulo();
lblResultadosC.Text = "El area del Cuadrado es: " + objetCC.Area_Cuadrado() + "\n Y
el Perimetro es: " + objetCC.Perimetro_Cuadrado();
lblResultadosCir.Text = "El area del Circulo es: " + objetCir.Area_Circulo() + "\n Y el
Perimetro es: " + objetCir.Perimetro_Circulo();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
}
}
}
10
Problemtica:
Realizar un programa, el cual tenga la funcin de que el usuario pueda ingresar un arreglo
de n cantidad de nmeros, con los cuales podr realizar las siguientes funciones: Invertir,
Multiplicar y Convertir
Diagrama de clases
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Numeros_conertir_multiplicar_invertir
{
publicclassNUMEROS
{
11
privateint[] a;
int pos, tam;
publicint[] A
{
get { return a; }
}
publicint Posicion
{
get { return pos; }
}
public NUMEROS()
{
a = newint[5];
tam = 5;
}
public NUMEROS(int t)
{
a = newint[t];
tam = t;
}
publicString Llenar(int x)
{
String mensaje="";
if (pos < tam)
{
a[pos] = x;
pos++;
}
else
mensaje = " Te has pasado!! ";
return mensaje;
}
publicint[] Invertir()
{
int[] Inver = newint[tam];
int w = pos-1;
for (int m = 0; m < pos; m++)
{
Invertiir[m] = a[w];
w--;
}
return Invertiir;
}
publicint[] Multiplicar()
{
int[] Mul = newint[tam];
for (int p = 0; p < pos; p++)
Mul[p]=5 * a[p];
return Mul;
}
publicint[] Convertir()
{
int mod;
int[]convert = newint[tam];
for (int s = 0; s < pos; s++)
{
12
mod = a[s] % 2;
if (mod == 0)
{
convert[s] = 0;
}
else
if (mod == 1)
{
convert [s] = 1;
}
}
returnconvert;
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Numeros_conertir_multiplicar_invertir;
namespaceFormulario_Numeros
{
publicpartialclassfmrNumeros : Form
{
NUMEROS N_objeto;
public fmrNumeros()
{
InitializeComponent();
}
privatevoid btnLlenar_Click(object sender, EventArgs e)
{
if (txtNumero1.Text == "")
MessageBox.Show(" Debes Ingresar algo primero ");
else
{
String m = N_objeto.Llenar(Convert.ToInt32(txtNumero1.Text));
if (m == "")
{
lstNumero1.Items.Add(txtNumero1.Text);
}
else
MessageBox.Show(m);
txtNumero1.Text = "";
txtNumero1.Focus();
13
14
(Multiplicar)
15
(Convertir)
16
Diagrama de clase:
17
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Operaciones
{
classNUMEROS
{
privatedouble num1;
privatedouble num2;
publicdouble Numero_1
{
get { return num1; }
set { num1 = value; }
}
publicdouble Numero_2
{
get { return num2; }
set { num2 = value; }
}
public NUMEROS()
{
num1 = 0;
num2 = 0;
}
public NUMEROS(double n1, double n2)
{
num1 = n1;
num2 = n2;
}
publicdouble Suma()
{
18
double suma = 0;
suma = num1 + num2;
return suma;
}
publicdouble Resta()
{
return num1 - num2;
}
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Numeros;
namespace Operaciones
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
privatevoid btnCalcular_Click(object sender, EventArgs e)
{
NUMERITOS NU_oper = new NUMERITOS();
NU_oper.Numero_1 = Convert.ToDouble(txtNumero1.Text);
NU_oper.Numero_2 = Convert.ToDouble(txtNumero2.Text);
lblResultado.Text = " El resultado de la suma es: " + NU_oper.Suma() + "\n El
resultado de la resta es: " + NU_oper.Resta();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
MessageBox.Show(" BIENVENIDO, OPRIME ACEPTAR PARA CONTINUAR... ");
}
}
}
19
Diagrama de clases:
20
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Clase_ventas
{
public class Ventas
{
private String descripcion;
private double costo;
//Propiedad
public String Descripcion
{
get { return descripcion; }
set { descripcion = value; }
}
public double Costo
{
get { return costo; }
set { costo = value; }
}
//Constructor
public Ventas()
{
descripcion = "";
costo = 0;
}
public Ventas(String d, double c)
{
descripcion = d;
21
costo = c;
//Metodos
public double precio_venta()
{
return costo + costo * 1.2 + costo * 0.15;
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Clase_ventas;
namespace Prueba_ventas
{
public partial class rfmVentas : Form
{
public rfmVentas()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnCalcular_Click(object sender, EventArgs e)
{
Ventas objeto = new Ventas();
objeto.Descripcion = txtDescripcion.Text;
objeto.Costo = Convert.ToDouble(txtCosto.Text);
MessageBox.Show(" El producto " + objeto.Descripcion + " Tiene un costo de: " +
objeto.precio_venta(),"Ventana de
resultados",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
}
}
}
22
Diagrama de clase:
Cdigo de la clase:
using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Text;
namespaceClase_Primos
{
publicclassPrimos
{
privateint[] N;
int pos = 0, tam;
publicint[] Num
{
get { return N; }
}
publicint Pos
{
get { return pos; }
}
public Primos()
{
N = newint[5];
tam = 5;
}
public Primos(int t)
24
{
}
N = newint[t];
tam = t;
publicString Llenar(int n)
{
String mensaje = "";
if (pos < tam)
{
N[pos] = n;
pos++;
}
else mensaje = "Arreglo lleno";
return mensaje;
}
publicString[] Es_primo()
{
Boolean Es_primo=false;
String[] res = newString[pos];
//Recorrer el numero de arreglo
for (int i = 0; i < pos; i++)
{
//Para contar los residuos
for (int j = 2; j < N[i]; j++)
{
if (N[i] % j == 0)
Es_primo = true;
}
if (Es_primo == true)
res[i] = "No es un nmero primo";
else
res[i] = " Es un nmero primo";
}
return res;
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
25
using
using
using
using
System.Linq;
System.Text;
System.Windows.Forms;
Numeros_Primos;
namespace Numeros_Primos
{
publicpartialclassForm1 : Form
{
Numeros_Primos
public Form1()
{
InitializeComponent();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
}
privatevoid cmbTamao_SelectedIndexChanged(object sender, EventArgs e)
{
objeto=new Numeros_Primos(Covert.ToInt32(cmbTamao)
}
privatevoid btnLlamar_Click(object sender, EventArgs e)
{
if (txtNumero.Text=="")
MessageBox.Show("Escribe algo")
else
{
String m=objeto.Llenar(Convert.ToInt32(
if (m=="")
{
lstNumeros.Items.Add(txtNumero.Text);
txtNumero.Text="";
txtNumero.Focus();
}
}
}
privatevoid btnPrimos_Click(object sender, EventArgs e)
{
String[]tem=newString [objeto.Pos];
temp=objeto.Es_primo();
lstResultado.Items
for (int i=0; i<objeto.Pos;i++);
27
Diagrama de clase:
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace Clase_Numeros._._.par_e_imprar
{
public class Numero
{
private int[] num;
private int pos = 0, tam;
//Propiedad
public int[] Num
{
get { return num; }
}
public int Pos
{
get { return pos; }
28
}
public Numero()
{
num = new int[10];
tam = 10;
}
//inicializar
public Numero(int t)
{
num = new int[t];
tam = t;
}
//Metodos
public String Llenar(int x)
{
String m = "";
if (pos < tam)
{
//llenar el arreglo de num
Num[pos] = x;
pos++;
}
else
m = "Arreglo lleno";
return m;
}
public int[] Pares()
{
int j = 0;
int[] par = new int[pos];
for (int i = 0; i < pos; i++)
{
if (num[i] % 2 == 0)
{
par[j] = num[i];
j++;
}
}
return par;
}
public int[] Impares()
{
int j = 0;
int[] impar = new int[pos];
for (int i = 0; i < pos; i++)
{
if (num[i] % 2 != 0)
{
impar[j] = num[i];
j++;
}
}
return impar;
29
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
Clase_Numeros._._.par_e_imprar;
namespace Formulario_Numero_pares_e_impares
{
public partial class Form1 : Form
{
Numero obj;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//Inicializar Arreglos
for (int i=1 ; i<31;i++)
{
cmbTamao.Items.Add(i);
}
}
private void cmbTamao_SelectedIndexChanged(object sender, EventArgs e)
{
// Covertir...obj=new Numero(cmbTamao.Text)
obj = new Numero(Convert.ToInt32(cmbTamao.Text));
}
private void btnLlenar_Click(object sender, EventArgs e)
{
String m = obj.Llenar(Convert.ToInt32(txtLlenar.Text));
if (m == "")
lstLlenar.Items.Add(txtLlenar.Text);
else
MessageBox.Show(m);
30
Prctica 8: Controles
31
Problemtica:
Realizar un programa de controles, el cual tenga la funcin de poder enlazar Formularios;
en el primer formulario realizar la funcin de que el usurario pueda ingresar una cantidad
de elementos y colocarlos en un listado para que posteriormente cuando se seleccione un
elemento del listado pueda dar, Cul es el elemento actual? Cul es su posicin
actual? Y Cul es el total de elementos agregados? En el segundo formulario poder
saber el Seno, Coseno y la Tangente con solo seleccionar ngulo. En el Tercer Formulario
poder seleccionar el color en una base determinada y ponerla en un ancho y altura que se
desea y Finalmente en el cuarto formulario tener una suma de vectores en dos diferentes
listBox para solo generarlos en un solo y tercer listBox.
Diagrama de clases:
Cdigo de la clase:
32
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
namespaceClase_suma
{
publicclassVec_Suma
{
privateint[] a, b;
intpos = 0, tam;
publicint[] A
{
get { return a; }
}
publicint[] B
{
get { return b; }
}
publicintPos
{
get { returnpos; }
}
publicVec_Suma()
{
a = newint[5];
b = newint[5];
tam = 5;
}
publicVec_Suma(int t)
{
a = newint[t];
b = newint[t];
tam = t;
}
publicStringllenar(int x, int y)
{
Stringmensaje="";
if (pos< tam)
{
a[pos] = x;
b[pos] = y;
pos++;
}
else
mensaje = "Error!! Te pasaste!!";
returnmensaje;
}
publicint[] Suma()
{
int[] Res = newint[tam];
for (int i = 0; i <pos; i++)
Res[i] = a[i] + b[i];
return Res;
}
}
33
34
lblActual.Text = "____________";
lblPosicion.Text = "_____________";
}
}
privatevoidlnkSiguiente_LinkClicked(objectsender,LinkLabelLinkClickedEventArgs e)
{
frmComboventana = newfrmCombo();
ventana.ShowDialog();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
}
2)-Seleccionar Angulo:
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespace controles_2
{
publicpartialclassfrmCombo : Form
{
publicfrmCombo()
{
InitializeComponent();
}
privatevoidcmbAngulo_SelectedIndexChanged(object sender, EventArgs e)
{
double x = Convert.ToDouble(cmbAngulo.Text);
lblSeno.Text = Math.Sin(x).ToString();
lblCoseno.Text = Math.Cos(x).ToString();
lblTangente.Text = Math.Tan(x).ToString();
}
privatevoidfrmCombo_Load(object sender, EventArgs e)
{
for (int i = 0; i <= 360; i+=10)
{
cmbAngulo.Items.Add(i);
}
}
privatevoidlnkSiguiente_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
35
3) Colores y tamao:
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespace controles_2
{
publicpartialclassfrmCombinados : Form
{
publicfrmCombinados()
{
InitializeComponent();
}
privatevoidfrmCombinados_Load(object sender, EventArgs e)
{
lstColor.Items.Add("Rojo");
lstColor.Items.Add("Amarillo");
lstColor.Items.Add("Verde");
lstColor.Items.Add("Azul");
for (int i = 0; i <= 3000; i += 100)
{
cmbAlto.Items.Add(i);
cmbAncho.Items.Add(i);
}
}
privatevoidlstColor_SelectedIndexChanged(object sender, EventArgs e)
{
switch (lstColor.SelectedIndex)
{
case 0: txtPrueba.BackColor = Color.Red; break;
case 1: txtPrueba.BackColor = Color.Yellow; break;
case 2: txtPrueba.BackColor = Color.Green; break;
case 3: txtPrueba.BackColor = Color.Blue; break;
}
}
privatevoidcmbAncho_SelectedIndexChanged(object sender, EventArgs e)
{
txtPrueba.Width = Convert.ToInt32(cmbAncho.Text);
}
privatevoidcmbAlto_SelectedIndexChanged(object sender, EventArgs e)
{
txtPrueba.Height = Convert.ToInt32(cmbAlto.Text);
36
4) Suma de Vectores:
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingClase_suma;
namespace controles_2
{
publicpartialclassfrmSuma : Form
{
Vec_Suma objeto;
public frmSuma()
{
InitializeComponent();
}
privatevoidbtnLlenar_Click(object sender, EventArgs e)
{
if (txtN1.Text == "" || txtN2.Text == "")
MessageBox.Show("Debes escribir valores primero");
else
{
String m=objeto.llenar(Convert.ToInt32(txtN1.Text), Convert.ToInt32(txtN2.Text));
if (!m.Equals(""))
MessageBox.Show(m);
else
{
lstN1.Items.Add(txtN1.Text);
lstN2.Items.Add(txtN2.Text);
}
}
}
privatevoidbtnSuma_Click(object sender, EventArgs e)
{
int[] R=newint[Convert.ToInt32(cmbTam.Text)];
R = objeto.Suma();
int num = objeto.Pos;
for (int i = 0; i <num; i++)
lstRes.Items.Add(R[i]);
}
privatevoidfrmSuma_Load(object sender, EventArgs e)
{
for (int i = 1; i <= 50; i++)
cmbTam.Items.Add(i);
37
}
privatevoidcmbTam_SelectedIndexChanged(object sender, EventArgs e)
{
objeto = newVec_Suma(Convert.ToInt32(cmbTam.Text));
}
38
3) Colores y tamao:
39
4) Suma de Vectores:
40
Problemtica:
41
Diagrama de la clase:
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace Mayor_edad
{
public class Mayor_de_edad
{
private String[] nombre;
private int[] edad;
int pos = 0, tam;
public String[] Nombre
{
get { return nombre; }
42
}
public int[] Edad
{
get { return edad; }
}
public int Pos
{
get { return pos; }
}
public Mayor_de_edad()
{
nombre = new String[10];
edad = new int[10];
tam = 10;
}
public Mayor_de_edad(int t)
{
nombre = new String[t];
edad = new int[t];
tam = t;
}
public String llenar(String x, int y)
{
String mensaje = "";
if (pos < tam)
{
nombre[pos] = x;
edad[pos] = y;
pos++;
}
else
mensaje = "debes seleccionar una cantidad mayor !!";
return mensaje;
}
public bool baja(String n)
{
bool encontro = false;
for (int i = 0; i < pos; i++)
{
if (nombre[i].Equals(n))
{
encontro = true;
for (int j = i; j < pos - 1; j++)
{
Nombre[j] = (nombre[j + 1]);
Edad[j] = (edad[j + 1]);
}
pos--;
}
}
return encontro;
}
public int consulta(String n)
{
int res = 0;
for (int i = 0; i < pos; i++)
43
if (nombre[i].Equals(n))
{
res = edad[i];
}
}
return res;
}
public String[] mayores()
{
String[] res = new String[tam];
int j = 0;
for (int i = 0; i < pos; i++)
{
if (edad[i] >= 18)
{
res[j] = nombre[i];
j++;
}
}
return res;
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
Mayor_edad;
namespace formulario_MayoresEdad
{
public partial class Form1 : Form
{
Mayor_de_edad objeto;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i <= 50; i++)
{
cmbTamao.Items.Add(i);
44
}
private void btnAgregar_Click(object sender, EventArgs e)
{
if (txtNombre.Text == "" || txtEdad.Text == "")
MessageBox.Show("no debes dejar el texto vacio");
else
{
String m = objeto.llenar(txtNombre.Text, Convert.ToInt32(txtEdad.Text));
if (!m.Equals(""))
MessageBox.Show(m);
else
{
lstEliminar.Items.Add(txtNombre.Text);
cmbNombres.Items.Add(txtNombre.Text);
}
}
txtNombre.Text = "";
txtEdad.Text = "";
txtNombre.Focus();
}
private void cmbNombres_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show("la edad es: " + objeto.consulta(cmbNombres.Text));
}
private void button1_Click(object sender, EventArgs e)
{
lstM_Edad.Items.Clear();
String[] r = new String[objeto.Pos];
r = objeto.mayores();
int c = 0;
while (r[c] != null)
{
lstM_Edad.Items.Add(r[c]);
c++;
}
}
private void button2_Click(object sender, EventArgs e)
{
bool res = false;
if (lstEliminar.SelectedIndex == -1)
MessageBox.Show("primero seleccione un elemento");
else
{
res = objeto.baja(lstEliminar.SelectedItem.ToString());
if (res == true)
{
45
lstEliminar.Items.Clear();
cmbNombres.Items.Clear();
String[] t = new String[objeto.Pos];
t = objeto.Nombre;
for (int i = 0; i < objeto.Pos; i++)
{
lstEliminar.Items.Add(t[i]);
cmbNombres.Items.Add(t[i]);
}
}
else
MessageBox.Show("no se encontro el nombre");
}
}
}
}
46
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Clase_varianza
{
public class EstVar
{
//Atributos
private int[] o;
int pos = 0, tam;
//Propiedades
public int[] O
{
get { return o; }
47
}
public int Pos
{
get { return pos; }
}
//Constructores
public EstVar()
{
o = new int[5];
tam = 5;
}
public EstVar(int t)
{
o = new int[t];
tam = t;
}
//Metodos
public String Llenar(int x)
{
String mensaje = "";
if (pos < tam)
{
o[pos] = x;
pos++;
}
else
mensaje = "Te has sobrepasado!!";
return mensaje;
}
public double Promedio()
{
double rest = new double();
for (int i = 0; i < tam; i++)
{
rest = (rest + o[i]);
}
return rest / tam;
}
public double Estandar()
{
double[] rest = new double[tam];
double r = 0;
for (int i = 0; i < tam; i++)
{
rest[i] = (o[i] - Promedio());
rest[i] = rest[i] * rest[i];
r = rest[i] + r;
}
r = r / tam;
r = Math.Sqrt(r);
return r;
}
public double Varianza()
{
double k = 0;
48
k = Estandar() * Estandar();
return k;
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Clase_varianza;
namespace Ejemplo_calculo
{
public partial class Form1 : Form
{
EstVar objeto;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 100; i++)
cmbTamao.Items.Add(i);
}
private void cmbTamao_SelectedIndexChanged(object sender, EventArgs e)
{
objeto = new EstVar(Convert.ToInt32(cmbTamao.Text));
}
private void btnAgregar_Click(object sender, EventArgs e)
{
if (txtAgregar.Text == "")
MessageBox.Show("Ingresa valores!!");
else
{
String m = objeto.Llenar(Convert.ToInt32(txtAgregar.Text));
if (!m.Equals(""))
MessageBox.Show(m);
else
{
lstNumeros.Items.Add(txtAgregar.Text);
lstNumeros.Focus();
49
}
private void btnCalcular_Click(object sender, EventArgs e)
{
lblVarianza.Text = (Convert.ToString(objeto.Varianza()));
lblEstandar.Text = (Convert.ToString(objeto.Estandar()));
txtAgregar.Text = "";
}
}
50
UNIDAD
II
51
Diagrama de clase
52
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace Clase_producto
{
public class Productos
{
public int Clave { get; set; }
public String Descripcion { get; set; }
public double Precio { get; set; }
public double Precio_mayoreo { get; set; }
public Productos()
{
Clave = 0;
Descripcion = "";
Precio = 0;
Precio_mayoreo = 0;
}
public Productos(int c, String d, double p, double pm)
{
Clave = c;
Descripcion = d;
Precio = p;
Precio_mayoreo = pm;
53
}
public double Ventas(int cantidad)
{
double pago = 0, descuento = 0, precios = 0;
if (cantidad < 10)
{
pago = cantidad * Precio;
}
if (cantidad >= 10 && cantidad < 20)
{
pago = cantidad * Precio_mayoreo;
}
else
if (cantidad >= 20)
{
precios= ((Precio_mayoreo * 10) / 100);
descuento = Precio_mayoreo - precios;
pago = descuento * cantidad;
}
return pago;
}
54
arr_productos[p].Precio = p;
arr_productos[p].Precio_mayoreo = pm;
}
else
mensaje = " Error! El sistema a rebasado su Limite";
return mensaje;
}
public double Compra_p(int p, int cant)
{
return arr_productos[p].Ventas(cant);
}
public Productos Buscar(int clav, int num)
{
for (int i = 0; i < num; i++)
{
if (clav == arr_productos[i].Clave)
return arr_productos[i];
}
return null;
}
public void Baja(int clav, int num)
{
for (int i = 0; i < num; i++)
{
if (clav == arr_productos[i].Clave || arr_productos[i] != null)
{
for (int k = i; k < num - 1; k++)
{
arr_productos[k] = arr_productos[k + 1];
}
}
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
Clase_producto;
55
namespace Formulario_productos
{
public partial class Form1 : Form
{
ARREGLO_PRODUCTOS Objeto;
Productos OBJ;
int numE = 0;
public Form1()
{
InitializeComponent();
}
private void btnSiguiente_Click(object sender, EventArgs e)
{
if (txtClaveAlta.Text == "" || txtDescripcin.Text == "" || txtPrecioMayoreo.Text ==
"" || txtPrecioMenudeo.Text == "")
MessageBox.Show(" No se han ingresado los Datos POR FAVOR!! Ingresa todos
los datos del producto ");
else
{
int cla = Convert.ToInt32(txtClaveAlta.Text);
String desc= txtDescripcin.Text;
double p = Convert.ToDouble(txtPrecioMenudeo.Text);
double pm = Convert.ToDouble(txtPrecioMayoreo.Text);
Objeto.Inicializar(numE);
String mens = Objeto.Llenar(numE, cla, desc, p, pm);
}
cmbClaveVentas.Items.Add(txtClaveAlta.Text);
cmbClaveBaja.Items.Add(txtClaveAlta.Text);
txtClaveAlta.Text = "";
txtDescripcin.Text = "";
txtPrecioMayoreo.Text = "";
txtPrecioMenudeo.Text = "";
numE++;
txtClaveAlta.Focus();
}
private void Form1_Load(object sender, EventArgs e)
{
Objeto = new ARREGLO_PRODUCTOS();
OBJ = new Productos();
}
private void btnCompra_Click(object sender, EventArgs e)
{
if (Convert.ToInt32(txtCantidad.Text) >= 10 && Convert.ToUInt32(txtCantidad.Text)
< 20)
{
rbMayoreo.Checked = true;
rbMenudeo.Checked = false;
chbDescuento.Checked = false;
MessageBox.Show(" Su Total a Pagar es de : $" +
Convert.ToString(OBJ.Ventas(Convert.ToInt32(txtCantidad.Text))) + ", El precio normal del
producto es de: $" + OBJ.Precio_mayoreo);
}
else
56
57
}
}
chbDescuento.Checked = false;
58
*Venta (Menudeo)
59
*Mensaje de la Venta
61
*Mensaje de la Venta
*Baja
62
Diagrama de clase
Cajero
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace Clase_Herencia
{
public class Empleado
{
public String nombre { get; set; }
public int edad { get; set; }
63
de
public Cajero()
: base()
{
Pago_diario = 0;
Antiguedad = 0;
}
public Cajero(String n, int e, String s, double pd, int a)
: base(n, e, s)
{
Pago_diario = pd;
Antiguedad = a;
}
public override double Sueldo()
{
double sueldo = 0;
return sueldo = Pago_diario * 30;
}
public double Prima_Vacacional()
{
double prima = 0;
if (Antiguedad < 12)
prima = ((Sueldo() * 10) / 100);
else
if (Antiguedad >= 12 && Antiguedad <= 24)
prima = ((Sueldo() * 30) / 100);
else
if (Antiguedad > 24)
prima = ((Sueldo() * 50) / 100);
return prima;
}
64
public Vendedor()
: base()
{
Num_ventas = 0;
}
public Vendedor(String n, int e, String s, int nv)
: base(n, e, s)
{
Num_ventas = nv;
}
public override double Sueldo()
{
double sueldo = 0;
if (Num_ventas <= 5000)
sueldo = ((Num_ventas * 10) / 100);
else
if (Num_ventas > 5000)
sueldo = ((Num_ventas * 15) / 100);
return sueldo;
}
public String Mensaje()
{
String mensaje = "";
return mensaje = nombre + " Tu sueldo es de: $" + Sueldo();
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
65
using System.Windows.Forms;
using Clase_empleados_herencia;
namespace Formulario_herencia
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void rbCajero_CheckedChanged(object sender, EventArgs e)
{
gpbCajero.Enabled = true;
gpbVendedor.Enabled = false;
}
private void rbVendedor_CheckedChanged(object sender, EventArgs e)
{
gpbVendedor.Enabled = true;
gpbCajero.Enabled = false;
}
private void btnCalcular_Click(object sender, EventArgs e)
{
Cajero OBJ = new Cajero();
Vendedor OBJ2 = new Vendedor();
if (rbCajero.Checked)
{
OBJ.nombre = txtNombre.Text;
OBJ.edad = Convert.ToInt32(txtEdad.Text);
OBJ.sexo = txtSexo.Text;
OBJ.Pago_diario = Convert.ToDouble(txtPagodia.Text);
MessageBox.Show(" Fecha de ingreo del empleado: " +
msFechaingreso.SelectionStart.ToShortDateString());
OBJ.Antiguedad = ((msFechaingreso.SelectionStart.Month - DateTime.Now.Month)
+ 12 * (msFechaingreso.SelectionStart.Year - DateTime.Now.Year)) * -1;
MessageBox.Show(" Su sueldo es de: $" + OBJ.Sueldo());
MessageBox.Show(" Prima vacacional es de: $" + OBJ.Prima_Vacacional());
}
else
if (rbVendedor.Checked)
{
OBJ2.nombre = txtNombre.Text;
OBJ2.edad = Convert.ToInt32(txtEdad.Text);
OBJ2.sexo = txtSexo.Text;
OBJ2.Num_ventas = Convert.ToInt32(txtMontoventa.Text);
MessageBox.Show(OBJ2.Mensaje());
}
}
66
67
*Fecha de Ingreso
*Sueldo Base
Vacacional
*Prima
68
*Sueldo Base
69
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace Clase_herencia
{
public class Empleado
{
public string nombre { get; set; }
public int edad { get; set; }
public double sueldo { get; set; }
public Empleado()
{
nombre = "";
edad = 0;
sueldo = 0;
}
public Empleado(string n, int e, double s)
{
70
nombre = n;
edad = e;
sueldo = s;
}
public virtual void Incremento(int p)
{
sueldo = sueldo + (sueldo * p / 100);
}
}
public class Ejecutivo : Empleado
{
public double compensacion { get; set; }
public Ejecutivo(string n, int e, double s, double c)
: base(n, e, s)
{
compensacion = c;
}
public Ejecutivo()
: base()
{
compensacion = 0;
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
71
using System.Windows.Forms;
using Clase_herencia;
namespace Formulario_sueldo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label6_Click(object sender, EventArgs e)
{
}
private void rbSecretaria_CheckedChanged(object sender, EventArgs e)
{
txtCompensacin.Enabled = false;
}
private void rbEjecutivo_CheckedChanged(object sender, EventArgs e)
{
txtCompensacin.Enabled = true;
}
private void btnCalcular_Click(object sender, EventArgs e)
{
Ejecutivo obj1 = new Ejecutivo();
Secretaria obj2 = new Secretaria();
if (rbEjecutivo.Checked)
{
obj1.nombre = txtNombre.Text;
obj1.edad = Convert.ToInt32(txtEdad.Text);
obj1.sueldo = Convert.ToDouble(txtSueldo.Text);
obj1.compensacion = Convert.ToDouble(txtCompensacin.Text);
obj1.Incremento(5);
obj1.sueldo_final();
lblTotal.Text = obj1.sueldo.ToString();
}
else
{
obj2.nombre = txtNombre.Text;
obj2.edad = Convert.ToInt32(txtEdad.Text);
obj2.sueldo = Convert.ToDouble(txtSueldo.Text);
obj2.Incremento(5);
lblTotal.Text = obj2.sueldo.ToString();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
72
73
Diagrama de clase:
74
Cdigo
de la
clase:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
{
public class Persona
{
public String
public int Edad { get; set; }
public String Direccion { get; set; }
public int Antiguedad { get; set; }
Clase_persona
public Persona()
{
Nombre = "";
Edad = 0;
Direccion = "";
Antiguedad = 0;
}
public Persona(String n, int e, String d, int a)
{
Nombre = n;
Edad = e;
Direccion = d;
Antiguedad = a;
}
public String categoria()
{
if (Antiguedad > 0 && Antiguedad <= 5)
return "Media plaza";
else
return "Plaza completa";
}
public virtual double calcular_aguinaldo()
{
return 0;
}
public virtual double prima_vacacional()
{
75
return 0;
}
public class Docente : Persona
{
public int horas_trabajadas { get; set; }
public double salario_hora { get; set; }
public Docente()
: base()
{
horas_trabajadas = 0;
salario_hora = 0;
}
public Docente(String n, int e, String d, int a, int ht, double sd)
: base(n, e, d, a)
{
horas_trabajadas = ht;
salario_hora = sd;
}
public double sueldo_mensual()
{
return horas_trabajadas * salario_hora * 20;
}
public override double calcular_aguinaldo()
{
return sueldo_mensual() * 2;
}
public override double prima_vacacional()
{
return horas_trabajadas * salario_hora * 25;
}
}
public class Administrativo : Persona
{
public double salario_diario { get; set; }
public String puesto { get; set; }
public Administrativo()
: base()
{
salario_diario = 0;
puesto = "";
}
public Administrativo(String n, int e, String d, int a, double sd, String p)
: base(n, e, d, a)
{
salario_diario = sd;
puesto = p;
}
public override double calcular_aguinaldo()
{
return salario_diario * 30 * 0.20;
}
public override double prima_vacacional()
{
76
switch (puesto)
{
case "Secretaria": return salario_diario * 10;
case "Jefe de Departamento": return salario_diario * 15;
case "Subdirector": return salario_diario * 20;
case "Director": return salario_diario * 30;
default: return 0;
}
}
77
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
78
using
using
using
using
using
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Herencia_Persona5;
namespace Herencia_5
{
public partial class Form1 : Form
{
ARREGLO_ADMINISTRATIVO objadministrativos;
ARREGLOS_DOCENTES objdocentes;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cmbPuesto.Items.Add("Secretaria");
cmbPuesto.Items.Add("Jefe de departamento");
cmbPuesto.Items.Add("Subdirector");
cmbPuesto.Items.Add("Director");
rbDocente.Checked = true;
gpbAdministrativos.Enabled = false;
}
private void rbDocente_CheckedChanged(object sender, EventArgs e)
{
gpbAdministrativos.Enabled = false;
gpbDocentes.Enabled = true;
}
private void rbAdministrativo_CheckedChanged(object sender, EventArgs e)
{
gpbAdministrativos.Enabled = true;
gpbDocentes.Enabled = false;
}
private void btnLimpiar_Click(object sender, EventArgs e)
{
txtNombre.Text = "";
txtDireccion.Clear();
txtHoratrabajadas.Clear();
txtSalariodiario.Clear();
txtSalariohora.Clear();
nudEdad.Value = 18;
nudAntiguedad.Value = 0;
lblAguinaldo.Text = "__________";
lblCategoria.Text = "___________";
lblPrimavacacional.Text = "___________";
lblSueldomensual.Text = "__________";
rbDocente.Checked = true;
gpbAdministrativos.Enabled = false;
79
gpbDocentes.Enabled = true;
80
81
82
Cdigo de la clase:
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Windows.Forms;
namespace Exepciones
{
class ALUMNOS
{
private int[] edad;
private String[] nombre;
private int tamao;
public ALUMNOS()
{
edad = new int[10];
nombre = new String[10];
tamao = 10;
}
public ALUMNOS(int tam)
{
edad = new int[tam];
83
}
public int[] Edad
{
get { return edad; }
}
public String[] Nombre
{
get { return nombre; }
}
public int Tamao
{
get { return tamao; }
}
public double Promedio()
{
double pro = 0;int i=0;
do
{
pro += edad[i] / tamao;
i++;
} while (i < tamao);
return pro;
}
public bool Llenar(int t, int e, String n)
{
try
{
edad[t] = e;
nombre[t] = n;
return true;
}
catch (Exception)
{
MessageBox.Show("El arreglo esta SATURADO!!!");
return false;
}
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
84
namespace Exepciones
{
public partial class frmPrincipal : Form
{
public frmPrincipal()
{
InitializeComponent();
}
private void divicionToolStripMenuItem_Click(object sender, EventArgs e)
{
fmrDivision ventana = new fmrDivision();
ventana.MdiParent = this;
ventana.Show();
}
private void ejercicio1ToolStripMenuItem_Click(object sender, EventArgs e)
{
fmrejercicio1 ventana = new fmrejercicio1();
ventana.MdiParent = this;
ventana.Show();
}
private void arreglosToolStripMenuItem_Click(object sender, EventArgs e)
{
fmrArreglos ventana = new fmrArreglos();
ventana.MdiParent = this;
ventana.Show();
}
private void frmPrincipal_Load(object sender, EventArgs e)
{
}
*Primera Prueba
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
namespace Exepciones
{
public partial class fmrejercicio1 : Form
{
public fmrejercicio1()
{
InitializeComponent();
}
85
}
catch (OverflowException)
{
MessageBox.Show("Pusiste un numero grande !!");
txtNumero.Text = "";
txtNumero.Focus();
}
catch (Exception error )
{
MessageBox.Show("Error innesperado"+error);
txtNumero.Text = "";
txtNumero.Focus();
}
finally
{
//Este bloque se ejecuta siempre !!
MessageBox.Show("Esto se ejecuta siempre");
}
*Ejemplo de divisiones
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
86
namespace Exepciones
{
public partial class fmrDivision : Form
{
public fmrDivision()
{
InitializeComponent();
}
private void btnDividir_Click(object sender, EventArgs e)
{
int x, y;
double res;
try
{
x = Convert.ToInt32(txtNumero1.Text);
y = Convert.ToInt32(txtNumero2.Text);
res = (double)x / y;
MessageBox.Show(" El resultado de la divicin es:" + res);
}
catch (OverflowException)
{
MessageBox.Show("Pusiste un numero grande !!");
txtNumero1.Text = "";
txtNumero2.Text = "";
txtNumero2.Focus();
}
catch (FormatException)
{
MessageBox.Show("No se acepta la letras !!");
txtNumero1.Text = "";
txtNumero2.Text = "";
txtNumero2.Focus();
}
catch (DivideByZeroException)
{
MessageBox.Show(" Division entre cero !!");
txtNumero1.Text = "";
txtNumero2.Text = "";
txtNumero2.Focus();
}
catch (Exception)
{
MessageBox.Show(" Error general ");
}
}
private void fmrDivision_Load(object sender, EventArgs e)
{
}
*Arreglo y clases
using System;
87
using
using
using
using
using
using
using
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
namespace Exepciones
{
public partial class fmrArreglos : Form
{
ALUMNOS obj;
int t = 0;
public fmrArreglos()
{
InitializeComponent();
}
private void btnGuardar_Click(object sender, EventArgs e)
{
try
{
if (obj.Llenar(t, Convert.ToInt32(txtEdad.Text), txtNombre.Text))
{
t++;
MessageBox.Show(" Elemento guardado... ");
txtEdad.Text = "";
txtNombre.Clear();
txtNombre.Focus();
}
}
catch(Exception error)
{
MessageBox.Show(error.Message);
}
}
private void btnTamo_Click(object sender, EventArgs e)
{
obj = new ALUMNOS(Convert.ToInt32(txtNoalumnos.Text));
MessageBox.Show("Se dimension el arreglo"+txtNoalumnos);
}
private void btnPromedio_Click(object sender, EventArgs e)
{
MessageBox.Show(" El promedio de edad fue: " + obj.Promedio());
}
private void fmrArreglos_Load(object sender, EventArgs e)
{
}
88
89
90
91
92
Cdigo de la clase:
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
namespace Empleado
{
public class EMPLEADO
{
public String Nombre { get; set; }
public int Edad { get; set; }
public String Sexo { get; set; }
93
94
if (diferencia > 6)
return "Normal";
else
return "No tienes derecho";
default: return "Sin Prestamo";
}
}
public double Monto_Prestamo()
{
if (Tipo_prestamo().Equals("Especial"))
return 60000;
else
if (Tipo_prestamo().Equals("Ordinario"))
return 30000;
else
if (Tipo_prestamo().Equals("Normal"))
return 10000;
else
return 0;
}
}
public class ARREGLOS_EMPLEADO
{
private EMPLEADO[] arr_empleados;
int pos = 0,tam;
public EMPLEADO[] Arr_empleados
{
get { return arr_empleados; }
}
public int Pos
{
get{return pos;}
}
public ARREGLOS_EMPLEADO()
{
arr_empleados = new EMPLEADO[5];
tam = 5;
}
public ARREGLOS_EMPLEADO(int t)
{
arr_empleados = new EMPLEADO[t];
tam = t;
}
public void Inicializar_elemento(int p)
{
arr_empleados[p] = new EMPLEADO();
}
public String Llenar(int p,String n, int e, String s, DateTime d, String pt,String fto)
{
String m = "";
if (p < tam)
{
arr_empleados[p].Nombre = n;
arr_empleados[p].Edad = e;
95
arr_empleados[p].Sexo = s;
arr_empleados[p].Fecha_ingreso = d;
arr_empleados[p].Puesto = pt;
arr_empleados[p].Foto = fto;
}
else
m = " SATURADO!!";
return m;
}
public String Tipo_prestamo(int p)
{
return arr_empleados[p].Tipo_prestamo();
}
public double Sueldo_base1(int p)
{
return arr_empleados[p].Sueldo_base();
}
public double Monto_prestamo(int p)
{
return arr_empleados[p].Monto_Prestamo();
}
public int Sabatico(int p)
{
return arr_empleados[p].Ao_Sabatico();
}
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
Empleado;
namespace Empleados
{
public partial class Form1 : Form
{
ARREGLOS_EMPLEADO Objetos;
96
int numE = 0;
String fotito = "";
public Form1()
{
InitializeComponent();
}
private void label10_Click(object sender, EventArgs e)
{
}
private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
cmbPuesto.Items.Add("Presidente");
cmbPuesto.Items.Add("Abogado");
cmbPuesto.Items.Add("Ingeniero en Sistemas");
cmbPuesto.Items.Add("Tecnico de Apoyo");
Objetos = new ARREGLOS_EMPLEADO();
}
private void btnLimpiar_Click(object sender, EventArgs e)
{
txtNombre.Text = "";
nudEdad.Value = 0;
rbFemenino.Checked = false;
rbMasculino.Checked = false;
dtpFechaIngreso.Value = DateTime.Now;
cmbPuesto.Text = "";
lblAosabatico.Text = "_______";
lblSuldobase.Text = "_______";
lblMontoprestamo.Text = "_______";
lblTipoprestamo.Text = "_______";
picFoto.Image = null;
}
private void btnAgregarEmpleado_Click(object sender, EventArgs e)
{
if (numE < 5)
{
int edad = Convert.ToInt32(nudEdad.Value);
String sexo;
if (rbFemenino.Checked == true)
sexo = rbFemenino.Text;
else
sexo = rbMasculino.Text;
DateTime fi;
fi = dtpFechaIngreso.Value.Date;
String puesto;
puesto = cmbPuesto.Text;
Objetos.Inicializar_elemento(numE);
97
98
99
100
Conclusin
Anteriormente no se tena la menor idea que sera tan complicado usar los formularios ya
que era un medio muy desconocido, ya que se manejaba un entorno muy diferente, pero
con la realizacin de los trabajos se fue mejorando y entendiendo el cmo manejar esta
plataforma.
Siguiendo con cada uno de los pasos que se estableci en la introduccin desde la
creacin de un diagrama de clases hasta la finalizacin de una aplicacin (Formulario).
Gracias a la participacin, se pudo entender el funcionamiento que tiene la creacin de
dichas clases para probarlas a un formulario, aunque an hay mucho esfuerzo por poder
entender algn cdigo que se establecen una aplicacin (Formulario).
101
102