Practica 4-4Visual.
namespace practica4_4v{
public partial class Form1 : Form
{
double temperatura, celsius, fah;
public Form1()
{
InitializeComponent();
temperatura = celsius = fah = 0.0;
}
private void button1_Click(object sender, EventArgs e)
{
temperatura = double.Parse(textBox1.Text);
if (checkBox1.Checked)
{
checkBox2.Checked = false;
celsius = (5.0 / 9.0) * (temperatura - 32.0);
listBox1.Items.Add("La temperatura Faherenheit es:" + temperatura);
listBox1.Items.Add("La temperatura Celsius es:" + celsius);
}
else
{
if (checkBox2.Checked)
{
fah = (9.0 / 5.0) * temperatura + 32.00;
listBox1.Items.Add("La temperatura Celsius es:" + temperatura);
listBox1.Items.Add("Convertir a Faherenheit" + fah);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
checkBox1.Checked = false;
checkBox2.Checked = false;
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}
No hay comentarios:
Publicar un comentario