Name: Abdul Wahab Munir Butt
Roll No: FA20-BSE-084
Department: Software Engineering
Course: Object Oriented Programming
Date: 01-08-2021
Calculator design:
Form1:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
,using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace calculator_cs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
float n1, n2;
float ans;
String operation;
Standard calcul;
private void button5_Click(object sender, EventArgs e)
{
textBox_click.Text += "1";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button11_Click(object sender, EventArgs e)
{
textBox_click.Text += "2";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button17_Click(object sender, EventArgs e)
{
textBox_click.Text += "3";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button4_Click(object sender, EventArgs e)
{
textBox_click.Text += "4";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button10_Click(object sender, EventArgs e)
{
textBox_click.Text += "5";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button16_Click(object sender, EventArgs e)
{
textBox_click.Text += "6";
, lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button3_Click(object sender, EventArgs e)
{
textBox_click.Text += "7";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button9_Click(object sender, EventArgs e)
{
textBox_click.Text += "8";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button15_Click(object sender, EventArgs e)
{
textBox_click.Text += "9";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button12_Click(object sender, EventArgs e)
{
textBox_click.Text += "0";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button18_Click(object sender, EventArgs e)
{
textBox_click.Text += ".";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button24_Click(object sender, EventArgs e)
{
if (operation == "sq")
{
Double ans;
ans = calcul.sq(n1);
textBox_click.Text = ans.ToString();
lblhistory_show.Text = n1 + "^2" + "=" + ans;
lblequation.Text = lblhistory_show.Text;
lblequation.Text = textBox_click.Text;
}
if (operation == "arcsin")
{
Double ans;
ans = calcul.arcsin(n1);
textBox_click.Text = ans.ToString();
lblhistory_show.Text = "arcsin" +n1 + "=" + ans;
lblequation.Text = lblhistory_show.Text;
Roll No: FA20-BSE-084
Department: Software Engineering
Course: Object Oriented Programming
Date: 01-08-2021
Calculator design:
Form1:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
,using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace calculator_cs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
float n1, n2;
float ans;
String operation;
Standard calcul;
private void button5_Click(object sender, EventArgs e)
{
textBox_click.Text += "1";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button11_Click(object sender, EventArgs e)
{
textBox_click.Text += "2";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button17_Click(object sender, EventArgs e)
{
textBox_click.Text += "3";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button4_Click(object sender, EventArgs e)
{
textBox_click.Text += "4";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button10_Click(object sender, EventArgs e)
{
textBox_click.Text += "5";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button16_Click(object sender, EventArgs e)
{
textBox_click.Text += "6";
, lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button3_Click(object sender, EventArgs e)
{
textBox_click.Text += "7";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button9_Click(object sender, EventArgs e)
{
textBox_click.Text += "8";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button15_Click(object sender, EventArgs e)
{
textBox_click.Text += "9";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button12_Click(object sender, EventArgs e)
{
textBox_click.Text += "0";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button18_Click(object sender, EventArgs e)
{
textBox_click.Text += ".";
lblequation.Text = textBox_click.Text;
lblhistory_show.Text = lblequation.Text;
}
private void button24_Click(object sender, EventArgs e)
{
if (operation == "sq")
{
Double ans;
ans = calcul.sq(n1);
textBox_click.Text = ans.ToString();
lblhistory_show.Text = n1 + "^2" + "=" + ans;
lblequation.Text = lblhistory_show.Text;
lblequation.Text = textBox_click.Text;
}
if (operation == "arcsin")
{
Double ans;
ans = calcul.arcsin(n1);
textBox_click.Text = ans.ToString();
lblhistory_show.Text = "arcsin" +n1 + "=" + ans;
lblequation.Text = lblhistory_show.Text;