martes, 23 de marzo de 2010

Practica 7 en "Visual".

Practica 7 Problema 2 visual
Codigo:
namespace practica_7_problema_2_visual
{
public partial class Form1 : Form
{
bolsa bolsamano;
camisa camisa;
tenis tenis;
toalla toalla;
pantalon pantalon;
double subtotal, total, impuesto, cantidad;

public Form1()
{
InitializeComponent();
bolsamano = new bolsa();
camisa = new camisa();
tenis = new tenis();
toalla = new toalla();
pantalon = new pantalon();
subtotal = total = impuesto=cantidad = 0;

}

private void button1_Click(object sender, EventArgs e)
{
bolsamano.Show();

}

private void button2_Click(object sender, EventArgs e)
{
camisa.Show();
}

private void button3_Click(object sender, EventArgs e)
{
tenis.Show();
}

private void button4_Click(object sender, EventArgs e)
{
toalla.Show();
}

private void button5_Click(object sender, EventArgs e)
{
pantalon.Show();

}

private void button6_Click(object sender, EventArgs e)
{
subtotal = bolsamano.cantidad + camisa.cantidad + tenis.cantidad + toalla.cantidad + pantalon.cantidad;
impuesto = bolsamano.impuesto + camisa.impuesto + tenis.impuesto + toalla.impuesto + pantalon.impuesto;
total = bolsamano.total + camisa.total + tenis.total + toalla.total + pantalon.total;
cantidad = bolsamano.cantidad + camisa.cantidad + tenis.cantidad + toalla.cantidad + pantalon.cantidad;
listBox1.Items.Add(" \"Factura\"");
listBox1.Items.Add(" ");
listBox1.Items.Add(" \tCantidad \tDescripcion \t Subtotal \tImpuesto \tTotal");
listBox1.Items.Add(" \t----------------------------------------------------------------------------------------------------------------------------------------");
listBox1.Items.Add(" \t" + bolsamano.cantidad + "\t\t Bolsa De Mano" + "\t" + bolsamano.subtotal + "\t\t" + bolsamano.impuesto + "\t\t" + bolsamano.total);
listBox1.Items.Add(" \t----------------------------------------------------------------------------------------------------------------------------------------");
listBox1.Items.Add(" \t" + camisa.cantidad + "\t\tCamisa" + "\t\t" + camisa.subtotal + "\t\t" + camisa.impuesto + "\t\t" + camisa.total);
listBox1.Items.Add(" \t----------------------------------------------------------------------------------------------------------------------------------------");
listBox1.Items.Add(" \t" + tenis.cantidad + "\t\tTenis" + "\t\t" + tenis.subtotal + "\t\t" + tenis.impuesto + "\t\t" + tenis.total);
listBox1.Items.Add(" \t----------------------------------------------------------------------------------------------------------------------------------------");
listBox1.Items.Add(" \t" + toalla.cantidad + "\t\tToalla M" + "\t\t" + toalla.subtotal + "\t\t" + toalla.impuesto + "\t\t" + toalla.total);
listBox1.Items.Add(" \t----------------------------------------------------------------------------------------------------------------------------------------");
listBox1.Items.Add(" \t" + pantalon.cantidad + "\t\tPantalón" + "\t\t" + pantalon.subtotal + "\t\t" + pantalon.impuesto + "\t\t" + pantalon.total);
listBox1.Items.Add(" \t====================================================================");
listBox1.Items.Add("\t"+cantidad+"\t\tTotal"+"\t\t"+subtotal+"\t\t"+impuesto+"\t\t"+total);

}

private void button7_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

private void button8_Click(object sender, EventArgs e)
{
Close();
}
}
}

Practica 7 Problema 3 visual
Codigo:
namespace practica_7_problema_3_visual
{
public partial class Form1 : Form
{
double serie, denominador;
int contador;


public Form1()
{
InitializeComponent();
serie = contador= 1;
denominador =0.0;

}

private void button1_Click(object sender, EventArgs e)
{
while (contador < 21)
{

denominador = denominador + 2;
serie =serie+ (1.0 / denominador);
contador++;
listBox1.Items.Add("serie= 1+1.0/ " + denominador);

}
listBox1.Items.Add(" ");
listBox1.Items.Add("serie= " + serie);
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}

private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:

Publicar un comentario