lunes, 22 de marzo de 2010

Practica 6 en "Visual".

Practica 6 Problema 1 visual
Codigo:
namespace Practica_6_problema_1_visual
{
public partial class Form1 : Form
{
Cuadrado cuadrado;
rectangulo rectangulo;
circulo circulo;
triangulo triangulo;
rombo rombo;
public Form1()
{
InitializeComponent();
cuadrado = new Cuadrado();
rectangulo = new rectangulo();
circulo = new circulo();
triangulo = new triangulo();
rombo = new rombo();
}

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

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

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

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

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

private void button6_Click(object sender, EventArgs e)
{
Close();
}
}
}
Form: Triangulo
namespace Practica_6_problema_1_visual
{
public partial class triangulo : Form
{
double lado1, lado2, lado3, perimetro, area, T;
public triangulo()
{
InitializeComponent();
lado1 = lado2 = lado3 = perimetro = area = T = 0;
}

private void button1_Click(object sender, EventArgs e)
{
lado1 = double.Parse(textBox1.Text);
lado2 = double.Parse(textBox2.Text);
lado3 = double.Parse(textBox3.Text);
perimetro = lado1 + lado2 + lado3;
T = (lado1 + lado2 + lado3) / 2;
area = Math.Sqrt(T * (T - lado1) * (T - lado2) * (T -lado3));
label5.Text = ("Perimetro= " + perimetro);
label6.Text = ("Area= " + area);

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
label5.Text = " ";
label6.Text = " ";
}

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


Practica 6 Problema 2 visual
Codigo:
namespace practica_6_problema_2_visual
{
public partial class Form1 : Form
{
holandeses_a_canadienses holacan;
griegas_a_norteamericano drcadolar;
canadiense_a_libra canalib;
norteamericano_a_francos dolarafran;
public Form1()
{
InitializeComponent();
holacan = new holandeses_a_canadienses();
drcadolar = new griegas_a_norteamericano();
canalib = new canadiense_a_libra();
dolarafran = new norteamericano_a_francos();
}

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

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

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

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

private void button5_Click(object sender, EventArgs e)
{
Close();
Form: Dracmas Griegas a Dolar Norteamericano
namespace practica_6_problema_2_visual
{
public partial class griegas_a_norteamericano : Form
{
double dracma, dolar, T;
public griegas_a_norteamericano()
{
InitializeComponent();
dracma = dolar = T = 0;
}

private void button1_Click(object sender, EventArgs e)
{
dracma = double.Parse(textBox1.Text);
T = (dracma * 2.95) / 100;
dolar = T * 1.06;
label3.Text = ("Cantidad en Dólares Norteamericanos= " + dolar);

}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
label3.Text = " ";
}

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

Practica 6 Problema 3 visual
Codigo:
namespace practica_6_problema_3
{
public partial class Form1 : Form
{
fahrenheit f;
celsius c;
kelvin k;
rankine r;
public Form1()
{
InitializeComponent();
f = new fahrenheit();
c = new celsius();
k = new kelvin();
r = new rankine();
}

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

}

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

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

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

}

private void button5_Click(object sender, EventArgs e)
{
Close();
}
}
}
Form: Fahrenheit
namespace practica_6_problema_3
{
public partial class fahrenheit : Form
{
double f, cel, kelvin, rankine;
public fahrenheit()
{

InitializeComponent();
f = cel = kelvin = rankine;

}

private void button1_Click(object sender, EventArgs e)
{
f = double.Parse(textBox1.Text);
cel = (5.0 / 9.0) * (f - 32);
kelvin = cel + 273;
rankine = f + 460;
listBox1.Items.Add("Grados Fahrenheit= " + f + "°F");
listBox1.Items.Add(" ");
listBox1.Items.Add("Grados Celsius= " + cel + "°C");
listBox1.Items.Add(" ");
listBox1.Items.Add("Grados Kelvin= " + kelvin + "°K");
listBox1.Items.Add(" ");
listBox1.Items.Add("Grados Rankine= " + rankine + "°R");
}

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

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

No hay comentarios:

Publicar un comentario