Exemplo n.º 1
0
        private void BtnIgual_Click(object sender, EventArgs e)
        {
            segundo = double.Parse(txtScreen.Text);

            double Sum;
            double Res;
            double Mul;
            double Div;
            double Por;

            switch (operador)
            {
            case "+":
                Sum            = obj.Sumar((primero), (segundo));
                txtScreen.Text = Sum.ToString();
                break;

            case "-":
                Res            = obj2.Restar((primero), (segundo));
                txtScreen.Text = Res.ToString();
                break;

            case "/":
                Div            = obj4.Dividir((primero), (segundo));
                txtScreen.Text = Div.ToString();
                break;

            case "*":
                Mul            = obj3.Multiplicar((primero), (segundo));
                txtScreen.Text = Mul.ToString();
                break;

            case "%":
                Por            = obj5.Porcentaje((primero), (segundo));
                txtScreen.Text = Por.ToString();
                break;
            }
        }
Exemplo n.º 2
0
        private void BttnIgual_Click(object sender, EventArgs e)
        {
            segundo = double.Parse(TxtPantalla.Text);
            double Sum;
            double Res;
            double Mul;
            double Div;
            double Por;

            switch (operador)
            {
            case "+":
                Sum = objt.Suma((first), (segundo));
                TxtPantalla.Text = Sum.ToString();
                break;

            case "-":
                Res = objt1.Resta((first), (segundo));
                TxtPantalla.Text = Res.ToString();
                break;

            case "*":
                Mul = objt2.Multiplicacion((first), (segundo));
                TxtPantalla.Text = Mul.ToString();
                break;

            case "/":
                Div = objt3.Division((first), (segundo));
                TxtPantalla.Text = Div.ToString();
                break;

            case "%":
                Por = objt4.Porcentaje((first), (segundo));
                TxtPantalla.Text = Por.ToString();
                break;
            }
        }