예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.checkBox1.Checked == true)
            {
                obj1           = new suma();
                obj1.S1        = double.Parse(val1.Text);
                obj1.S2        = double.Parse(val2.Text);
                resultado.Text = obj1.calcular().ToString();
            }
            else if (this.checkBox2.Checked == true)
            {
                obj2           = new restas();
                obj2.R1        = double.Parse(val1.Text);
                obj2.R2        = double.Parse(val2.Text);
                resultado.Text = obj2.calcular().ToString();
            }

            else if (this.checkBox3.Checked == true)
            {
                obj3           = new multiplcaciones();
                obj3.M1        = double.Parse(val1.Text);
                obj3.M2        = double.Parse(val2.Text);
                resultado.Text = obj1.calcular().ToString();
            }
            else if (this.checkBox4.Checked == true)
            {
                obj4           = new divisiones();
                obj4.D1        = double.Parse(val1.Text);
                obj4.D2        = double.Parse(val2.Text);
                resultado.Text = obj4.calcular().ToString();
            }
        }
예제 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     objmult        = new multiplcaciones();
     objmult.M1     = double.Parse(val1.Text);
     objmult.M2     = double.Parse(val2.Text);
     resultado.Text = objmult.calcular().ToString();
 }