viernes, 26 de marzo de 2010

practica 8 problema 3

namespace Practica8_problema3V
{
public partial class PlantaT : Form
{
public double DP1, DP2, DP3, DP4, DP5, DP6, DP7, DD1, DD2, DD3, DD4, DD5, DD6, DD7, PD1, PD2, PD3, PD4, PD5, PD6, PD7, TP, TD, Tpd;
public PlantaT()
{
InitializeComponent();
DP1 = DP2 = DP3 = DP4 = DP5 = DP6 = DP7 = DD1 = DD2 = DD3 = DD4 = DD5 = DD6 = DD7 = PD1 = PD2 = PD3 = PD4 = PD5 = PD6 = PD7 = TP = TD = Tpd = 0.0;
}

private void btPlantaH_Click(object sender, EventArgs e)
{
DP1 = double.Parse(txtBH1.Text);
DD1 = double.Parse(txtBH2.Text);
DP2 = double.Parse(txtBH4.Text);
DD2 = double.Parse(txtBH5.Text);
DP3 = double.Parse(txtBH7.Text);
DD3 = double.Parse(txtBH8.Text);
DP4 = double.Parse(txtBH10.Text);
DD4 = double.Parse(txtBH11.Text);
DP5 = double.Parse(txtBH13.Text);
DD5 = double.Parse(txtBH14.Text);
DP6 = double.Parse(txtBH16.Text);
DD6 = double.Parse(txtBH17.Text);
DP7 = double.Parse(txtBH19.Text);
DD7 = double.Parse(txtBH20.Text);

PD1 = DD1 / DP1;
PD2 = DD2 / DP2;
PD3 = DD3 / DP3;
PD4 = DD4 / DP4;
PD5 = DD5 / DP5;
PD6 = DD6 / DP6;
PD7 = DD7 / DP7;
TP = DP1 + DP2 + DP3 + DP4 + DP5 + DP6 + DP7;
TD = DD1 + DD2 + DD3 + DD4 + DD5 + DD6 + DD7;
Tpd = TD / TP;

txtBH3.Text = PD1.ToString();
txtBH6.Text = PD2.ToString();
txtBH9.Text = PD3.ToString();
txtBH12.Text = PD4.ToString();
txtBH15.Text = PD5.ToString();
txtBH18.Text = PD6.ToString();
txtBH21.Text = PD7.ToString();
txtBH22.Text = TP.ToString();
txtBH23.Text = TD.ToString();
txtBH24.Text = Tpd.ToString();
}

private void btBorrar_Click(object sender, EventArgs e)
{
txtBH1.Focus();
txtBH1.Clear();
txtBH10.Clear();
txtBH11.Clear();
txtBH12.Clear();
txtBH13.Clear();
txtBH14.Clear();
txtBH15.Clear();
txtBH16.Clear();
txtBH17.Clear();
txtBH18.Clear();
txtBH19.Clear();
txtBH2.Clear();
txtBH20.Clear();
txtBH21.Clear();
txtBH22.Clear();
txtBH23.Clear();
txtBH24.Clear();
txtBH3.Clear();
txtBH4.Clear();
txtBH5.Clear();
txtBH6.Clear();
txtBH7.Clear();
txtBH8.Clear();
txtBH9.Clear();
}

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

private void PlantaT_Load(object sender, EventArgs e)
{

}
}
}

namespace Practica8_problema3V
{
public partial class PlantaM : Form
{
public double DP1, DP2, DP3, DP4, DP5, DP6, DP7, DD1, DD2, DD3, DD4, DD5, DD6, DD7, PD1, PD2, PD3, PD4, PD5, PD6, PD7, TP, TD, Tpd;
public PlantaM()
{
InitializeComponent();
DP1 = DP2 = DP3 = DP4 = DP5 = DP6 = DP7 = DD1 = DD2 = DD3 = DD4 = DD5 = DD6 = DD7 = PD1 = PD2 = PD3 = PD4 = PD5 = PD6 = PD7 = TP = TD = Tpd = 0.0;
}

private void btPlantaH_Click(object sender, EventArgs e)
{
DP1 = double.Parse(txtBH1.Text);
DD1 = double.Parse(txtBH2.Text);
DP2 = double.Parse(txtBH4.Text);
DD2 = double.Parse(txtBH5.Text);
DP3 = double.Parse(txtBH7.Text);
DD3 = double.Parse(txtBH8.Text);
DP4 = double.Parse(txtBH10.Text);
DD4 = double.Parse(txtBH11.Text);
DP5 = double.Parse(txtBH13.Text);
DD5 = double.Parse(txtBH14.Text);
DP6 = double.Parse(txtBH16.Text);
DD6 = double.Parse(txtBH17.Text);
DP7 = double.Parse(txtBH19.Text);
DD7 = double.Parse(txtBH20.Text);

PD1 = DD1 / DP1;
PD2 = DD2 / DP2;
PD3 = DD3 / DP3;
PD4 = DD4 / DP4;
PD5 = DD5 / DP5;
PD6 = DD6 / DP6;
PD7 = DD7 / DP7;
TP = DP1 + DP2 + DP3 + DP4 + DP5 + DP6 + DP7;
TD = DD1 + DD2 + DD3 + DD4 + DD5 + DD6 + DD7;
Tpd = TD / TP;

txtBH3.Text = PD1.ToString();
txtBH6.Text = PD2.ToString();
txtBH9.Text = PD3.ToString();
txtBH12.Text = PD4.ToString();
txtBH15.Text = PD5.ToString();
txtBH18.Text = PD6.ToString();
txtBH21.Text = PD7.ToString();
txtBH22.Text = TP.ToString();
txtBH23.Text = TD.ToString();
txtBH24.Text = Tpd.ToString();
}

private void btBorrar_Click(object sender, EventArgs e)
{
txtBH1.Focus();
txtBH1.Clear();
txtBH10.Clear();
txtBH11.Clear();
txtBH12.Clear();
txtBH13.Clear();
txtBH14.Clear();
txtBH15.Clear();
txtBH16.Clear();
txtBH17.Clear();
txtBH18.Clear();
txtBH19.Clear();
txtBH2.Clear();
txtBH20.Clear();
txtBH21.Clear();
txtBH22.Clear();
txtBH23.Clear();
txtBH24.Clear();
txtBH3.Clear();
txtBH4.Clear();
txtBH5.Clear();
txtBH6.Clear();
txtBH7.Clear();
txtBH8.Clear();
txtBH9.Clear();
}

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

private void PlantaM_Load(object sender, EventArgs e)
{

}
}
}

namespace Practica8_problema3V
{
public partial class PlantaH : Form
{
public double DP1, DP2, DP3, DP4, DP5, DP6, DP7, DD1, DD2, DD3, DD4, DD5, DD6, DD7, PD1, PD2, PD3, PD4, PD5, PD6, PD7, TP, TD, Tpd;
public PlantaH()
{
InitializeComponent();
DP1 = DP2 = DP3 = DP4 = DP5 = DP6 = DP7 = DD1 = DD2 = DD3 = DD4 = DD5 = DD6 = DD7 = PD1 = PD2 = PD3 = PD4 = PD5 = PD6 = PD7 = TP = TD = Tpd = 0.0;
}



private void btBorrar_Click(object sender, EventArgs e)
{
txtBH1.Focus();
txtBH1.Clear();
txtBH10.Clear();
txtBH11.Clear();
txtBH12.Clear();
txtBH13.Clear();
txtBH14.Clear();
txtBH15.Clear();
txtBH16.Clear();
txtBH17.Clear();
txtBH18.Clear();
txtBH19.Clear();
txtBH2.Clear();
txtBH20.Clear();
txtBH21.Clear();
txtBH22.Clear();
txtBH23.Clear();
txtBH24.Clear();
txtBH3.Clear();
txtBH4.Clear();
txtBH5.Clear();
txtBH6.Clear();
txtBH7.Clear();
txtBH8.Clear();
txtBH9.Clear();

}

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

private void btPlantaH_Click(object sender, EventArgs e)
{
DP1 = double.Parse(txtBH1.Text);
DD1 = double.Parse(txtBH2.Text);
DP2 = double.Parse(txtBH4.Text);
DD2 = double.Parse(txtBH5.Text);
DP3 = double.Parse(txtBH7.Text);
DD3 = double.Parse(txtBH8.Text);
DP4 = double.Parse(txtBH10.Text);
DD4 = double.Parse(txtBH11.Text);
DP5 = double.Parse(txtBH13.Text);
DD5 = double.Parse(txtBH14.Text);
DP6 = double.Parse(txtBH16.Text);
DD6 = double.Parse(txtBH17.Text);
DP7 = double.Parse(txtBH19.Text);
DD7 = double.Parse(txtBH20.Text);

PD1 = DD1 / DP1;
PD2 = DD2 / DP2;
PD3 = DD3 / DP3;
PD4 = DD4 / DP4;
PD5 = DD5 / DP5;
PD6 = DD6 / DP6;
PD7 = DD7 / DP7;
TP = DP1 + DP2 + DP3 + DP4 + DP5 + DP6 + DP7;
TD = DD1 + DD2 + DD3 + DD4 + DD5 + DD6 + DD7;
Tpd = TD / TP;

txtBH3.Text = PD1.ToString();
txtBH6.Text = PD2.ToString();
txtBH9.Text = PD3.ToString();
txtBH12.Text = PD4.ToString();
txtBH15.Text = PD5.ToString();
txtBH18.Text = PD6.ToString();
txtBH21.Text = PD7.ToString();
txtBH22.Text = TP.ToString();
txtBH23.Text = TD.ToString();
txtBH24.Text = Tpd.ToString();

}

private void PlantaH_Load(object sender, EventArgs e)
{

}


}
}


namespace Practica8_problema3V
{
public partial class PlantaG : Form
{
public double DP1, DP2, DP3, DP4, DP5, DP6, DP7, DD1, DD2, DD3, DD4, DD5, DD6, DD7, PD1, PD2, PD3, PD4, PD5, PD6, PD7, TP, TD, Tpd;
public PlantaG()
{
InitializeComponent();
DP1 = DP2 = DP3 = DP4 = DP5 = DP6 = DP7 = DD1 = DD2 = DD3 = DD4 = DD5 = DD6 = DD7 = PD1 = PD2 = PD3 = PD4 = PD5 = PD6 = PD7 = TP = TD = Tpd = 0.0;
}

private void btPlantaH_Click(object sender, EventArgs e)
{
DP1 = double.Parse(txtBH1.Text);
DD1 = double.Parse(txtBH2.Text);
DP2 = double.Parse(txtBH4.Text);
DD2 = double.Parse(txtBH5.Text);
DP3 = double.Parse(txtBH7.Text);
DD3 = double.Parse(txtBH8.Text);
DP4 = double.Parse(txtBH10.Text);
DD4 = double.Parse(txtBH11.Text);
DP5 = double.Parse(txtBH13.Text);
DD5 = double.Parse(txtBH14.Text);
DP6 = double.Parse(txtBH16.Text);
DD6 = double.Parse(txtBH17.Text);
DP7 = double.Parse(txtBH19.Text);
DD7 = double.Parse(txtBH20.Text);

PD1 = DD1 / DP1;
PD2 = DD2 / DP2;
PD3 = DD3 / DP3;
PD4 = DD4 / DP4;
PD5 = DD5 / DP5;
PD6 = DD6 / DP6;
PD7 = DD7 / DP7;
TP = DP1 + DP2 + DP3 + DP4 + DP5 + DP6 + DP7;
TD = DD1 + DD2 + DD3 + DD4 + DD5 + DD6 + DD7;
Tpd = TD / TP;

txtBH3.Text = PD1.ToString();
txtBH6.Text = PD2.ToString();
txtBH9.Text = PD3.ToString();
txtBH12.Text = PD4.ToString();
txtBH15.Text = PD5.ToString();
txtBH18.Text = PD6.ToString();
txtBH21.Text = PD7.ToString();
txtBH22.Text = TP.ToString();
txtBH23.Text = TD.ToString();
txtBH24.Text = Tpd.ToString();

}

private void btBorrar_Click(object sender, EventArgs e)
{
txtBH1.Focus();
txtBH1.Clear();
txtBH10.Clear();
txtBH11.Clear();
txtBH12.Clear();
txtBH13.Clear();
txtBH14.Clear();
txtBH15.Clear();
txtBH16.Clear();
txtBH17.Clear();
txtBH18.Clear();
txtBH19.Clear();
txtBH2.Clear();
txtBH20.Clear();
txtBH21.Clear();
txtBH22.Clear();
txtBH23.Clear();
txtBH24.Clear();
txtBH3.Clear();
txtBH4.Clear();
txtBH5.Clear();
txtBH6.Clear();
txtBH7.Clear();
txtBH8.Clear();
txtBH9.Clear();
}

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

private void PlantaG_Load(object sender, EventArgs e)
{

}
}
}

namespace Practica8_problema3V
{
public partial class PlantaC : Form
{
public double DP1, DP2, DP3, DP4, DP5, DP6, DP7, DD1, DD2, DD3, DD4, DD5, DD6, DD7, PD1, PD2, PD3, PD4, PD5, PD6, PD7, TP, TD, Tpd;
public PlantaC()
{
InitializeComponent();
DP1 = DP2 = DP3 = DP4 = DP5 = DP6 = DP7 = DD1 = DD2 = DD3 = DD4 = DD5 = DD6 = DD7 = PD1 = PD2 = PD3 = PD4 = PD5 = PD6 = PD7 = TP = TD = Tpd = 0.0;
}

private void btPlantaH_Click(object sender, EventArgs e)
{
DP1 = double.Parse(txtBH1.Text);
DD1 = double.Parse(txtBH2.Text);
DP2 = double.Parse(txtBH4.Text);
DD2 = double.Parse(txtBH5.Text);
DP3 = double.Parse(txtBH7.Text);
DD3 = double.Parse(txtBH8.Text);
DP4 = double.Parse(txtBH10.Text);
DD4 = double.Parse(txtBH11.Text);
DP5 = double.Parse(txtBH13.Text);
DD5 = double.Parse(txtBH14.Text);
DP6 = double.Parse(txtBH16.Text);
DD6 = double.Parse(txtBH17.Text);
DP7 = double.Parse(txtBH19.Text);
DD7 = double.Parse(txtBH20.Text);

PD1 = DD1 / DP1;
PD2 = DD2 / DP2;
PD3 = DD3 / DP3;
PD4 = DD4 / DP4;
PD5 = DD5 / DP5;
PD6 = DD6 / DP6;
PD7 = DD7 / DP7;
TP = DP1 + DP2 + DP3 + DP4 + DP5 + DP6 + DP7;
TD = DD1 + DD2 + DD3 + DD4 + DD5 + DD6 + DD7;
Tpd = TD / TP;

txtBH3.Text = PD1.ToString();
txtBH6.Text = PD2.ToString();
txtBH9.Text = PD3.ToString();
txtBH12.Text = PD4.ToString();
txtBH15.Text = PD5.ToString();
txtBH18.Text = PD6.ToString();
txtBH21.Text = PD7.ToString();
txtBH22.Text = TP.ToString();
txtBH23.Text = TD.ToString();
txtBH24.Text = Tpd.ToString();
}

private void btBorrar_Click(object sender, EventArgs e)
{
txtBH1.Focus();
txtBH1.Clear();
txtBH10.Clear();
txtBH11.Clear();
txtBH12.Clear();
txtBH13.Clear();
txtBH14.Clear();
txtBH15.Clear();
txtBH16.Clear();
txtBH17.Clear();
txtBH18.Clear();
txtBH19.Clear();
txtBH2.Clear();
txtBH20.Clear();
txtBH21.Clear();
txtBH22.Clear();
txtBH23.Clear();
txtBH24.Clear();
txtBH3.Clear();
txtBH4.Clear();
txtBH5.Clear();
txtBH6.Clear();
txtBH7.Clear();
txtBH8.Clear();
txtBH9.Clear();
}

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

private void PlantaC_Load(object sender, EventArgs e)
{

}
}
}

namespace Practica8_problema3V
{
public partial class Form1 : Form
{
PlantaH ph;
PlantaG pg;
PlantaT pt;
PlantaC pc;
PlantaM pm;
public Form1()
{
ph = new PlantaH();
pg = new PlantaG();
pt = new PlantaT();
pc = new PlantaC();
pm = new PlantaM();
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void btHermosillo_Click(object sender, EventArgs e)
{
ph.Show();
}

private void btGuamuchil_Click(object sender, EventArgs e)
{
pg.Show();
}

private void btTijuana_Click(object sender, EventArgs e)
{
pt.Show();
}

private void btCuliacan_Click(object sender, EventArgs e)
{
pc.Show();
}

private void btMexico_Click(object sender, EventArgs e)
{
pm.Show();
}

private void btReporte_Click(object sender, EventArgs e)
{
double TotalProduccion = ph.TP + pg.TP + pt.TP + pc.TP + pm.TP;
double TotalDefectos = ph.TD + pg.TD + pt.TD + pm.TD + pc.TD;
double PocentajeDef = ph.Tpd + pg.Tpd + pt.Tpd + pc.Tpd + pm.Tpd;
listBox1.Items.Add("\t\tReporte de Control de Calidad");
listBox1.Items.Add("Planta \t\tUnidades \t\t Unidades \t%");
listBox1.Items.Add("\t\tproducidas \t\tdefectuosas \tdefectuosas");
listBox1.Items.Add("\nHermosillo\t\t" + ph.TP + "\t\t" + ph.TD + "\t\t" + ph.Tpd);
listBox1.Items.Add("\nGuamuchil \t\t" + pg.TP + "\t\t" + pg.TD + "\t\t" + pg.Tpd);
listBox1.Items.Add("\nTijuana \t\t" + pt.TP + "\t\t" + pt.TD + "\t\t" + pt.Tpd);
listBox1.Items.Add("\nCuliacan \t\t" + pc.TP + "\t\t" + pc.TD + "\t\t" + pc.Tpd);
listBox1.Items.Add("\nMexico \t\t" + pm.TP + "\t\t" + pm.TD + "\t\t" + pm.Tpd);
listBox1.Items.Add("\nTotales \t\t" + TotalProduccion + "\t\t" + TotalDefectos + "\t\t" + PocentajeDef);
}
}
}



miércoles, 10 de marzo de 2010

practica8problema2
































namespace practica8problema2V
{
public partial class Form1 : Form
{
int numero;
int contador, mayor, pos;

public Form1()
{
InitializeComponent();
numero = mayor = pos = 0;
contador = 1;
listBox1.Items.Add("Lista de los numeros");

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
numero = int.Parse(textBox1.Text);
listBox1.Items.Add(numero);
if (contador < 5)
{
if (numero > mayor)
{
mayor = numero;
pos = contador;
}
}
else
{
if (numero > mayor)
{
mayor = numero;
pos = contador;
}
listBox1.Items.Add("El numero mayor es=" + mayor);
listBox1.Items.Add("La posicion del numero mayor es=" + pos);
}
contador++;
textBox1.Clear();
textBox1.Focus();

}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
listBox1.Items.Add("Lista de los numeros");
mayor = 0;
contador = 1;
pos = 0;
}

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















namespace practica8problema2
{
class Program
{
static void Main(string[] args)
{
int mayor=0, I, numero=0,pos=1;
for (I = 1; I <= 5; I = I + 1)
{
Console.WriteLine("Introduce un valor entero:");
numero = int.Parse(Console.ReadLine());

if (numero > mayor)
{
mayor = numero;
pos = I;
}




}
Console.WriteLine("El dato mayor es={0}", mayor);
Console.WriteLine("La posicion del numero mayor es={0}", pos);
Console.ReadLine();

}
}
}

Practica8problema1

Pseudo Codigo

1. Point “Galones Litros”

Double G, Litros for G=100 to 200 step 10

{
Litros = G* 3.785
Print G, Litros
}

fin


namespace practica8problema1C
{
class Program
{
static void Main(string[] args)
{double G, Litros;
Console.WriteLine("GALONES LITROS");
for (G = 100; G <= 200; G = G + 10)
{
Litros = G * 3.785;
Console.WriteLine("{0} \t\t {1}", G, Litros);
}

Console.ReadKey();
}
}
}


















namespace practica8problema1V
{
public partial class Form1 : Form
{
double G, Litros;

public Form1()
{
InitializeComponent();
G = 0.0;
Litros = 0.0;
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
for (G = 100; G <= 200; G = G + 10)
{
Litros = G * 3.785;
listBox1.Items.Add("Galones\t" + G + "\tLitros\t" + Litros);
}
}

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

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

lunes, 8 de marzo de 2010

practica7problema3


























namespace practica7problema3V
{
public partial class Form1 : Form
{
double serie;
int contador;
double denominador;

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

private void Form1_Load(object sender, EventArgs e)
{

}

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

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


}

}

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

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

namespace practica7problema3
{
class Program
{
static void Main(string[] args)
{
double serie = 1.0;
int contador = 1;
double denominador = 0.0;
Console.WriteLine("serie= 1+\t");
while (contador < 20)
{
denominador = denominador + 2;
Console.Write("1/{0} +\t", denominador);
serie = serie + 1.0 / denominador;
contador++;
}
Console.WriteLine(" = {0:f4}", serie);
Console.ReadKey();


}
}
}

practica7problema2

namespace practica7problema2V
{
public partial class Form1 : Form
{
double BM, C, T, To, P = 0.0;
double Total = 0.0;
string opcion;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
opcion = (textBox1.Text);
switch (opcion)
{

case "1":

BM = double.Parse(textBox2.Text);
Total = Total + BM * 28.50;
break;

case "2":

C = int.Parse(textBox2.Text);
Total = Total + C * 45.00;
break;

case "3":

T = int.Parse(textBox2.Text);
Total = Total + T * 99.0;
break;

case "4":

To = int.Parse(textBox2.Text);
Total = Total + To * 49.99;
break;

case "5":

P = int.Parse(textBox2.Text);
Total = Total + P * 68.50;
break;
default: label9.Text = "ERROR";
break;
}
}

private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Add("\nCantidad Producto Subtotal");
if (BM > 0)
{
listBox1.Items.Add("" + BM + " Bolsa de mano " + BM * 28.50);
}
if (C > 0)
{
listBox1.Items.Add("" + C + " Camisa " + C * 45.00);
}
if (T > 0)
{
listBox1.Items.Add("" + T + " Tenis " + T * 99.00);
}
if (To > 0)
{
listBox1.Items.Add("" + To + " Toalla M. " + To * 49.99);
}
if (P > 0)
{
listBox1.Items.Add("" + P + " Pantalon " + P * 68.50);
}

listBox1.Items.Add(" Subtotal= " + Total);
listBox1.Items.Add(" IVA(11%)= " + Total * 0.11);
listBox1.Items.Add(" total= " + Total * 1.11);
}

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

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
















namespace practica7problema2C
{
class Program
{
static void Main(string[] args)
{
double BM=0.0,C=0.0,T=0.0,To=0.0,P=0.0,Total=0.0;
char continuar;
do

{
Console.Clear();



Console.WriteLine("Nombre de producto\t Descripcion\t Precio de lista");
Console.WriteLine("1\t Bolsa de mano\t $28.50");
Console.WriteLine("2\t Camisa\t $45.0");
Console.WriteLine("3\t Tenis\t $99.0");
Console.WriteLine("4\t Toalla M.\t $49.99");
Console.WriteLine("5\t Pantalon\t $68.50");
Console.WriteLine("Seleccione un articulo del (1-5)");

string opcion = (Console.ReadLine());
switch (opcion)
{
case "1": Console.WriteLine("Cantidad de Bolsas de mano:");
BM=double.Parse(Console.ReadLine());
Total= Total + BM*28.50;
break;

case "2": Console.WriteLine("Cantidad de Camisas:");
C=double.Parse(Console.ReadLine());
Total= Total + C*45.0;
break;

case "3": Console.Write("Cantidad de Tenis:");
T=double.Parse(Console.ReadLine());
Total= Total + T*99.0;
break;

case "4": Console.WriteLine("Cantidad de Toallas M.:");
To=double.Parse(Console.ReadLine());
Total= Total + To*49.99;
break;

case "5": Console.WriteLine("Cantidad de Pantalones:");
P=double.Parse(Console.ReadLine());
Total= Total + P*68.50;
break;

default:
Console.WriteLine("ERROR");
break;
}
Console.Write("Desea agregar otro producto s Si / n No : ");
continuar = char.Parse(Console.ReadLine());
}
while (continuar == 's');

Console.WriteLine("Cantidad Producto Subtotal");

if (BM > 0)
{
Console.WriteLine("{0}\t\tBolsa de Mano\t\t{1}", BM, BM * 28.50);
}
if (C > 0)
{
Console.WriteLine("{0}\t\tCamisa\t\t\t{1}", C, C * 45.0);
}
if (T > 0)
{
Console.WriteLine("{0}\t\tTenis\t\t{1}", T, T * 99.0);
}
if (To > 0)
{
Console.WriteLine("{0}\t\tToalla\t\t{1}", To, To * 49.99);
}
if (P > 0)
{
Console.WriteLine("{0}\t\tPantalon\t\t{1}", P, P * 68.50);
}
Console.WriteLine("El subtotal de la compra es={0}", Total);
Console.WriteLine("El IVA(11%) es igual a={0}", Total * 0.11);
Console.WriteLine("El total de la compra es={0}", Total * 1.11);
Console.ReadKey();





}
}
}

miércoles, 3 de marzo de 2010

Practica7problema1












namespace practica7_problema1V
{
public partial class Form1 : Form
{
string Nombre;
int Edad, co, cc, F, M;
double Peso, Est;
char Sexo;
public Form1()
{
InitializeComponent();
F = 0;
M = 0;

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Edad = int.Parse(textBox2.Text);
Peso = double.Parse(textBox3.Text);
Est = double.Parse(textBox4.Text);
Nombre = textBox1.Text;
if (checkBox1.Checked)
{ Sexo = 'M'; }
if (checkBox2.Checked)
{ Sexo = 'F'; }
if (checkBox3.Checked)
{ co=1; }
if (checkBox4.Checked)
{ co=2; }
if (checkBox5.Checked)
{ co=3; }
if (checkBox6.Checked)
{ cc=1; }
if (checkBox7.Checked)
{ cc=2; }
if (checkBox8.Checked)
{ cc=3; }

if (Sexo == 'F' && co == 1 && cc == 2 && Est >= 1.65 && Est <= 1.75 && Peso < 55)
{ F = F + 1; }
if (Sexo == 'M' && co == 2 && Est > 1.70 && Peso >= 60 && Peso <= 70)
{ M = M + 1; }
listBox1.Items.Add("El numero de mujeres con caracteristicas especificas es de = " + F);
listBox1.Items.Add("El numero de hombres con caracteristicas especificas es de = " + M);
}

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

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




















namespace practica7problema1C
{
class Program
{
static void Main(string[] args)
{
string nombre;
string sexo;
int edad,color_ojos, color_cabello, numero_F, numero_M;
double estatura;
double peso;
char continuar;
do
{
Console.Clear();
nombre = "";
sexo = "";
numero_F = 0;
numero_M = 0;
estatura = 0.0;
peso = 0.0;
edad = 0;
color_cabello = 0;
color_ojos = 0;

Console.Write("Introduce el nombre del alumno:");
nombre = (Console.ReadLine());
Console.Write("Sexo (F=femenino M=masculino):");
sexo = (Console.ReadLine());
Console.Write("Introduce la Edad:");
edad = int.Parse(Console.ReadLine());
Console.Write("Introduce la estatura (en metros):");
estatura = double.Parse(Console.ReadLine());
Console.Write("Introduce el peso(en kilogramos):");
peso = double.Parse(Console.ReadLine());
Console.Write("Introduce el color de cabello (1-castaño, 2-rubio, 3-otro):");
color_cabello = int.Parse(Console.ReadLine());
Console.Write("Introduce el color de ojos (1-azul, 2-castaño, 3-otro):");
color_ojos = int.Parse(Console.ReadLine());
if (sexo == "F" && color_ojos == 1 && color_cabello==2 && estatura >= 1.65 && estatura <= 1.75 && peso < 55)
{ numero_F = numero_F + 1; }
if (sexo == "M" && color_ojos == 2 && estatura > 1.70 && peso >= 60 && peso <= 70)
{ numero_M = numero_M + 1; }


Console.Write("Desea calcular otra conversion s Si / n No : ");
continuar = char.Parse(Console.ReadLine());
Console.WriteLine("El numero de mujeres con color de ojos azul, cabello rubio de estatura entre 1.65m y 1.75m y de peso menos de 55kg es: {0}", numero_F);
Console.WriteLine("El numero de hombres con color de ojos castaños de mas de 1.70 metros de estatura entre los 60kg y 70kg es: {0}", numero_M);
}
while (continuar == 's');

Console.ReadKey();








}

}
}


Definir variables
Nombre string
Sexo char
Edad int
Estatura float
Peso float
Color_ojos int
Color_cabello int
Numero_f=0 int
Numero_m=0 int
Constinuar=1 int

While(continuar==1)
{
Print “Nombre alumno:”
Read Nombre
Print “Sexo(F=femenino M=masculino):”
Read Edad
Print “Estatura(en metros):”
Read Estatura
Print “Peso(En kilos)”
Read Peso
Print “Color de ojos(1 azul, 2 castaño,3 otro)”
Read Color_ojos
Print “Color de cabello(1 castaño, 2 Rubio, 3 Otro)”
Read Color_cabello
If(Sexo==’F’ &&color_ojos==1 && Esratura>=1.65 && estatura<=1.75 && peso<55)
{num_f=num_f+1}
If(sexo==’m’ && color_ojos=1 &&estatura>1.70 &&peso>=60 &&peso<=70)
{num_m=num_m+1}
Print (“Desea registrar otro alumno(0=no 1=si):”
Read continuar
}
Print (“Numero de alumnos de sexo femenino color de ojos azul estatura >=1.65 y <=1.75 peso<55”,num_f)
Print(“Numero de alumnos sexo masculino de color de ojos castaños de estatura mayor a 1.70 y peso entre 60 y 70 kilos”,num_m)
}

lunes, 1 de marzo de 2010

Practica6Problema3






















namespace practica6_problema3V
{
public partial class Form1 : Form
{
F F1;
C F2;
K F3;
R F4;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
F1 = new F();
F1.Show();
}

private void button2_Click(object sender, EventArgs e)
{
F2 = new C();
F2.Show();
}

private void button3_Click(object sender, EventArgs e)
{
F3 = new K();
F3.Show();
}

private void button4_Click(object sender, EventArgs e)
{
F4 = new R();
F4.Show();
}
}
}

namespace practica6_problema3V
{
public partial class F : Form
{
double Fah, Cel, Kel, Ran;

public F()
{
InitializeComponent();
Fah = 0.0;
Cel = 0.0;
Kel = 0.0;
Ran = 0.0;
}


private void F_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Fah = double.Parse(textBox1.Text);
Cel = (5.0 / 9.0) * (Fah - 32.00);
Kel = Cel + 273.00;
Ran = Fah + 460;
listBox1.Items.Add("Celcius: " + Cel);
listBox1.Items.Add("Kelvin: " + Kel);
listBox1.Items.Add("Rankine: " + Ran);

}

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

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

namespace practica6_problema3V
{
public partial class C : Form
{
double Fah, Cel, Kel, Ran;

public C()
{
InitializeComponent();
Fah = 0.0;
Cel = 0.0;
Kel = 0.0;
Ran = 0.0;
}

private void C_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Cel = double.Parse(textBox1.Text);
Fah = (9.0 / 5.0) * (Cel + 32);
Kel = Cel + 273;
Ran = Fah + 460;
listBox1.Items.Add("Fahrenheit: " + Fah);
listBox1.Items.Add("Kelvin: " + Kel);
listBox1.Items.Add("Rankine: " + Ran);
}

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

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

namespace practica6_problema3V
{
public partial class K : Form
{
double Fah,Cel,Kel,Ran;

public K()
{
InitializeComponent();
Fah = 0.0;
Cel = 0.0;
Kel = 0.0;
Ran = 0.0;
}

private void button1_Click(object sender, EventArgs e)
{
Kel = double.Parse(textBox1.Text);
Cel = Kel - 273;
Fah = (9.0 / 5.0) * (Cel + 32.0);
Ran = Fah + 460;
listBox1.Items.Add("Fahrenheit: " + Fah);
listBox1.Items.Add("Celsius: " + Cel);
listBox1.Items.Add("Rankine: " + Ran);
}

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

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

namespace practica6_problema3V
{
public partial class R : Form
{
double Fah, Cel, Kel, Ran;

public R()
{
InitializeComponent();
Fah = 0.0;
Cel = 0.0;
Kel = 0.0;
Ran = 0.0;
}

private void R_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
Ran = double.Parse(textBox1.Text);
Fah = Ran - 460;
Cel = (5.0 / 9.0) * (Fah - 32.0);
Kel = Cel + 273;
listBox1.Items.Add("Fahrenheit: " + Fah);
listBox1.Items.Add("Celsius: " + Cel);
listBox1.Items.Add("Kelvin: " + Kel);
}

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

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
















namespace Practica6problema3
{
class Program
{
static void Main(string[] args)
{
double Celsius, Kelvin, Fahrenheit, Rankine;
char continuar;
do
{
Console.Clear();
Celsius = 0.0;
Kelvin = 0.0;
Fahrenheit = 0.0;
Rankine = 0.0;

Console.WriteLine("Que tipo de grados desea convertir");
Console.WriteLine(" a) Fahrenheit:");

Console.WriteLine(" b) Celsius:");

Console.WriteLine(" c) Kelvin:");

Console.WriteLine(" d) Rankine:");

string opcion = (Console.ReadLine());
switch (opcion)
{
case "a": Console.WriteLine("Introduce la cantidad de grados Fahrenheit:");
Fahrenheit = double.Parse(Console.ReadLine());
Celsius = (5.0 / 9.0) * (Fahrenheit - 32.00);
Kelvin = (Celsius + 273);
Rankine = (Fahrenheit + 460);
Console.WriteLine(" Las conversiones de grados Celsius son={0}", Celsius);
Console.WriteLine(" Las conversiones de grados Kelvin son={0}", Kelvin);
Console.WriteLine(" Las conversiones de grados Rankine son={0}", Rankine);
break;

case "b": Console.WriteLine("Introduce la cantidad de grados Celsius:");
Celsius = double.Parse(Console.ReadLine());
Fahrenheit = (9.0 / 5.0) * (Celsius + 32.00);
Kelvin = (Celsius + 273);
Rankine = (Fahrenheit + 460);
Console.WriteLine(" Las conversiones de grados Fahrenheit son={0}", Fahrenheit);
Console.WriteLine(" Las conversiones de grados Kelvin son={0}", Kelvin);
Console.WriteLine(" Las conversiones de grados Rankine son={0}", Rankine);
break;

case "c": Console.WriteLine("Introduce la cantidad de grados Kelvin:");
Kelvin = double.Parse(Console.ReadLine());
Celsius = (Kelvin - 273);
Fahrenheit = (9.0 / 5.0) * (Celsius + 32.00);
Rankine = (Fahrenheit + 460);
Console.WriteLine(" Las conversiones de grados Celsius son={0}", Celsius);
Console.WriteLine(" Las conversiones de grados Fahrenheit son={0}", Fahrenheit);
Console.WriteLine(" Las conversiones de grados Rankine son={0}", Rankine);

break;

case "d": Console.WriteLine("Introduce la cantidad de grados Rankine:");
Rankine = double.Parse(Console.ReadLine());
Fahrenheit = (Rankine - 460);
Celsius = (5.0 / 9.0) * (Fahrenheit - 32.00);
Kelvin = (Celsius + 273);
Console.WriteLine(" Las conversiones de grados Fahrenheit son={0}", Fahrenheit);
Console.WriteLine(" Las conversiones de grados Celsius son={0}", Celsius);
Console.WriteLine(" Las conversiones de grados Kelvin son={0}", Kelvin);
break;

default:
Console.WriteLine("ERROR");
break;
}
Console.Write("Desea calcular otra conversion s Si / n No : ");
continuar = char.Parse(Console.ReadLine());
}
while (continuar == 's');
Console.ReadKey();
}
}
}

Practica 6 problema 2






















namespace practica6_problema2V
{
public partial class Form1 : Form
{
FHDC F1;
DGDN F2;
DCLB F3;
DNFF F4;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
F1 = new FHDC();
F1.Show();
}
else
{
if (checkBox2.Checked)
{
F2 = new DGDN();
F2.Show();
}
else
{
if (checkBox3.Checked)
{
F3 = new DCLB();
F3.Show();
}
else
{
if (checkBox4.Checked)
{
F4 = new DNFF();
F4.Show();
}

}
}
}

}

}
}

namespace practica6_problema2V
{
public partial class FHDC : Form
{
double FH, DC;

public FHDC()
{
InitializeComponent();
FH = 0.0;
DC = 0.0;
}

private void button1_Click(object sender, EventArgs e)
{
FH = double.Parse(textBox1.Text);
DC = (FH * 43.20) / 100;
textBox2.Text = "" + DC;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
}

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

namespace practica6_problema2V
{
public partial class DGDN : Form
{
double DG, DN;

public DGDN()
{
InitializeComponent();
DG = 0.0;
DN = 0.0;
}

private void DGDN_Load(object sender, EventArgs e)
{


}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox1.Focus();
}

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

private void button1_Click(object sender, EventArgs e)
{
DG = double.Parse(textBox1.Text);

DN = (DG * 2.95) / (100 * 1.06);
textBox2.Text = "" + DN;
}
}
}

namespace practica6_problema2V
{
public partial class DCLB : Form
{
double DC, LB;

public DCLB()
{
InitializeComponent();
DC = 0.0;
LB = 0.0;
}

private void DCLB_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
DC = double.Parse(textBox1.Text);

LB = (DC / 1.84);
textBox2.Text = "" + LB;

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox1.Focus();
}

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

namespace practica6_problema2V
{
public partial class DNFF : Form
{
double DN, FF;

public DNFF()
{
InitializeComponent();
DN = 0.0;
FF = 0.0;
}

private void DNFF_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
DN = double.Parse(textBox1.Text);
FF = (DN * 1.06 * 100) / 21.55;
textBox2.Text = "" + FF;
}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Focus();
textBox1.Clear();
textBox2.Clear();
}

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































namespace Practica6problema2
{
class Program
{
static void Main(string[] args)
{
double ff, lb, dg, fh, cs, dn, dc;
char continuar;
do
{
Console.Clear();
fh = 0.0;
dg = 0.0;
dc = 0.0;
dn = 0.0;

Console.WriteLine("Lista de las tasas de cambio de moneda extranjera durante 1977");
Console.WriteLine("100 francos franceses = 21.55 dolares canadienses");
Console.WriteLine("1 libra britanica = 1.84 dolares canadienses");
Console.WriteLine("100 dracmas griegas = 2.95 dolares canadienses");
Console.WriteLine("100 florines holandeses = 43.20 dolares canadienses");
Console.WriteLine("100 coronas suecas = 24.25 dolares canadienses");
Console.WriteLine("1 dolar norteamericano = 1.06 dolares canadienses");
Console.WriteLine("Opciones de conversion");
Console.WriteLine(" a) Cantidad de florines holandeses para convertir a dolares canadienses:");

Console.WriteLine(" b) Cantidad de dracmas griegas para convertir a dolar norteamericano:");

Console.WriteLine(" c) Cantidad de dolares canadienses para convertir a libra britanica:");

Console.WriteLine(" d) Cantidad de dolares norteamericanos para convertir a francos franceses:");


string opcion = (Console.ReadLine());
switch (opcion)
{
case "a": Console.WriteLine("Introduce la cantidad de florines holandeses:");
fh = double.Parse(Console.ReadLine());
dc = (fh * 43.20) / 100;
Console.WriteLine(" La cantidad en dolares canadienses={0} ", dc);
break;

case "b": Console.WriteLine("Introduce la cantidad de dracmas griegas:");
dg = double.Parse(Console.ReadLine());
dn = (dg * 2.95) / (100 * 1.06);
Console.WriteLine(" La cantidad en dolares norteamericanos={0} ", dn);
break;

case "c": Console.WriteLine("Introduce la cantidad de dolares canadienses:");
dc = double.Parse(Console.ReadLine());
lb = (dc / 1.84);
Console.WriteLine(" La cantidad en libras britanicas es={0} ", lb);
break;

case "d": Console.WriteLine("Introduce la cantidad de dolares norteamericanos:");
dn = double.Parse(Console.ReadLine());
ff = (dn * 1.06 * 100) / 21.55;
Console.WriteLine(" La cantidad en francos franceses es={0} ", ff);
break;

default:
Console.WriteLine("Error tecla equivocada");
break;
}
Console.Write("Desea calcular otra conversion s Si / n No : ");
continuar = char.Parse(Console.ReadLine());

}
while (continuar == 's');
Console.ReadKey();

}

}
}