sábado, 18 de octubre de 2014

Temperaturas: Grados centigrados, fahrenheit, rankine y kelvin


 private void TGCYF_Load(object sender, EventArgs e)
        {

        }

        private void Clear_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox7.Text = "";
            textBox8.Text = "";
            textBox9.Text = "";
            textBox10.Text = "";
            textBox11.Text = "";
            textBox12.Text = "";
            textBox13.Text = "";
            textBox14.Text = "";
            textBox15.Text = "";
            textBox16.Text = "";
         
        }

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

        private void button1_Click(object sender, EventArgs e)
        {
            double C, F, K, R;
            C = double.Parse(textBox1.Text);
            F = C * 9 / 5 + 32;
            K = C + 273.15;
            R = (9 * C / 5) + 491.67;
            textBox2.Text = F.ToString();
            textBox3.Text = K.ToString();
            textBox4.Text = R.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            double R, C, F, K;
            R = double.Parse(textBox5.Text);
            C = 5 * (R - 491.67) / 9;
            F = R - 459.67;
            K = 5 * (R - 491.67) / 9 + 273.15;
            textBox6.Text = C.ToString();
            textBox7.Text = F.ToString();
            textBox8.Text = K.ToString();

        }

        private void button3_Click(object sender, EventArgs e)
        {
            double F, C, K, R;
            F = double.Parse(textBox9.Text);
            C = (5 * (F - 32)) / 9;
            K = 5 * (F - 32) / 9 + 273.15;
            R = F + 459.67;
            textBox10.Text = C.ToString();
            textBox11.Text = K.ToString();
            textBox12.Text = R.ToString();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            double K, C, F, R;
            K = double.Parse(textBox13.Text);
            C = K - 273.15;
            F = 9 * (K - 273.15) / 5 + 32;
            R = 9 * (K - 273.15) / 5 + 491.67;
            textBox14.Text = C.ToString();
            textBox15.Text = F.ToString();
            textBox16.Text = R.ToString();
        }
    }
}

No hay comentarios:

Publicar un comentario