private void UnaryOperator_Click(object sender, System.EventArgs e) { if (textBox1.Text == "") { textBox1.Text = "0"; } else { Button btn = (Button)sender; switch (btn.Text) { case "Sq. Rt.": textBox1.Text = (ArithmaticOperations.SquareRoot(double.Parse(textBox1.Text))).ToString(); break; case "Log x": textBox1.Text = (ScientificOperations.Log10(double.Parse(textBox1.Text))).ToString(); break; case "Ln x": textBox1.Text = (ScientificOperations.Ln(double.Parse(textBox1.Text))).ToString(); break; case "1/x": textBox1.Text = (ScientificOperations.Inverse(double.Parse(textBox1.Text))).ToString(); break; case "!": textBox1.Text = (ScientificOperations.Factorial(int.Parse(textBox1.Text))).ToString(); break; case "+/-": textBox1.Text = (ArithmaticOperations.PlusMinus(double.Parse(textBox1.Text))).ToString(); break; case "Sin": textBox1.Text = (ScientificOperations.Sin(double.Parse(textBox1.Text))).ToString(); break; case "Cos": textBox1.Text = (ScientificOperations.Cos(double.Parse(textBox1.Text))).ToString(); break; case "Tan": textBox1.Text = (ScientificOperations.Tan(double.Parse(textBox1.Text))).ToString(); break; case "<-": if (textBox1.Text.Length > 0) { int len = textBox1.Text.Length; textBox1.Text = textBox1.Text.Substring(0, len - 1); } if (textBox1.Text == "") { textBox1.Text = "0"; } break; } } }
public double Calculate() { return(ScientificOperations.Cos(_degree)); }