Exemplo n.º 1
0
        private void btnEquals_Click(object sender, EventArgs e)
        {
            input = Parser(txtboxInputOutput.Text);

            if (btnPlusClicked == true)
            {
                output = Arithmetic.Add(temp, input);
            }

            else if (btnMinusClicked == true)
            {
                output = Arithmetic.Subtract(temp, input);
            }

            else if (btnDivideClicked == true)
            {
                output = Arithmetic.Divide(temp, input);
            }

            else if (btnMultiplyClicked == true)
            {
                output = Arithmetic.Multiply(temp, input);
            }

            else if (btnInverseClicked == true)
            {
                output = Algebraic.Inverse(input);
            }

            else if (btnSquareRootClicked == true)
            {
                output = Algebraic.SquareRoot(input);
            }

            else if (btnCubeRootClicked == true)
            {
                output = Algebraic.CubeRoot(input);
            }

            else if (btnTanClicked == true)
            {
                output = Trigonometric.Tan(input);
            }

            else if (btnSinClicked == true)
            {
                output = Trigonometric.Sine(input);
            }

            else if (btnCosClicked == true)
            {
                output = Trigonometric.Cosine(input);
            }

            txtboxInputOutput.Text = output.ToString();
        }
Exemplo n.º 2
0
 //tests if display isnt empty
 // then it tests if the number is 0 or over, if so it calcuates the cube root, then displays result
 // or displays an error saying number must be positive
 //or displays an error for missing number
 private void btnCubeRT_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtboxDisplay.Text))
     {
         calcNumOne = DoubleParse(txtboxDisplay.Text);
         if (calcNumOne >= 0)
         {
             txtboxDisplay.Text = Algebraic.CubeRoot(calcNumOne);
         }
         else
         {
             MessageBox.Show("Number must be positive", "Error Message");
             txtboxDisplay.Text = "0";
         }
         equalPress = true;
     }
     else
     {
         MessageBox.Show("Missing number", "Error Message");
     }
 }