Form1 Coding
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Cartoon
{
public partial class Form1 : Form
{
double a, b, Ang;
public Form1()
{
InitializeComponent();
}
private void
button1_Click(object sender, EventArgs e)
{
a
= Convert.ToDouble(textBox1.Text);
b
= Convert.ToDouble(textBox2.Text);
Class1 C1 = new Class1();
textBox3.Text = Convert.ToString(C1.Add(a,b));
}
private void
button2_Click(object sender, EventArgs e)
{
a
= Convert.ToDouble(textBox1.Text);
b
= Convert.ToDouble(textBox2.Text);
Class1 C1 = new Class1();
textBox3.Text = Convert.ToString(C1.Subtract(a,b));
}
private void
button3_Click(object sender, EventArgs e)
{
a
= Convert.ToDouble(textBox1.Text);
b
= Convert.ToDouble(textBox2.Text);
Class1 C1 = new Class1();
textBox3.Text = Convert.ToString(C1.Multiply(a,b));
}
private void
button4_Click(object sender, EventArgs e)
{
a
= Convert.ToDouble(textBox1.Text);
b
= Convert.ToDouble(textBox2.Text);
Class1 C1 = new Class1();
textBox3.Text = Convert.ToString(C1.Divide(a,
b));
}
private void
button5_Click(object sender, EventArgs e)
{
Ang = Convert.ToDouble(textBox4.Text);
Class1 C1 = new Class1();
textBox5.Text = Convert.ToString(C1.Sin(Ang));
}
private void
button6_Click(object sender, EventArgs e)
{
Ang = Convert.ToDouble(textBox4.Text);
Class1 C2 = new Class1();
textBox5.Text = Convert.ToString(C2.Cos(Ang));
}
private void
button7_Click(object sender, EventArgs e)
{
Ang = Convert.ToDouble(textBox4.Text);
Class1 C3 = new Class1();
textBox5.Text = Convert.ToString(C3.Tan(Ang));
}
private void
radioButton2_CheckedChanged(object sender, EventArgs e)
{
label2.Visible = true;
label3.Visible = true;
label4.Visible = true;
label5.Visible = false;
label6.Visible = false;
textBox1.Visible = true;
textBox2.Visible = true;
textBox3.Visible = true;
button1.Visible = true;
button2.Visible = true;
button3.Visible = true;
button4.Visible = true;
textBox4.Visible = false;
textBox5.Visible = false;
button5.Visible= false;
button6.Visible = false;
button7.Visible = false;
}
private void
radioButton1_CheckedChanged(object sender, EventArgs e)
{
label5.Visible = true;
label6.Visible = true;
label2.Visible = false;
label3.Visible = false;
label4.Visible = false;
textBox4.Visible = true;
textBox5.Visible = true;
button5.Visible = true;
button6.Visible = true;
button7.Visible = true;
textBox1.Visible = false;
textBox2.Visible = false;
textBox3.Visible = false;
button1.Visible = false;
button2.Visible = false;
button3.Visible = false;
button4.Visible = false;
}
}
}
Method class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cartoon
{
class Class1
{
double Answer,Ang_Value;
public double Add(double x, double y)
{
Answer = x + y;
return Answer;
}
public double
Subtract(double x, double
y)
{
Answer = x - y;
return Answer;
}
public double
Multiply(double x, double
y)
{
Answer = x * y;
return Answer;
}
public double Divide(double x, double y)
{
Answer = x / y;
return Answer;
}
public double Sin(double a)
{
if (a == 0)
{
Ang_Value = 0;
}
else
if (a == 30)
{
Ang_Value = 0.5;
}
else
if (a == 45)
{
Ang_Value = 0.7071;
}
else
if (a == 60)
{
Ang_Value = 0.8660;
}
else
if (a == 90)
{
Ang_Value = 1;
}
return Ang_Value;
}
public double Cos(double a)
{
if (a == 0)
{
Ang_Value = 1;
}
else
if (a == 30)
{
Ang_Value = 0.8660;
}
else
if (a == 45)
{
Ang_Value = 0.7071;
}
else
if (a == 60)
{
Ang_Value = 0.5;
}
else
if (a == 90)
{
Ang_Value = 0;
}
return Ang_Value;
}
public double Tan(double a)
{
if (a == 0)
{
Ang_Value = 0;
}
else
if (a == 30)
{
Ang_Value = 0.5773;
}
else
if (a == 45)
{
Ang_Value = 1;
}
else
if
(a == 60)
{
Ang_Value = 1.7320;
}
return Ang_Value;
}
}
}