void BtnEqualClick(object sender, EventArgs e) { fraction a = new fraction(); fraction b = new fraction(); fraction c = new fraction(); if (rdbPlus.Checked == true) { a.top = int.Parse(txtTop1.Text); a.bottom = int.Parse(txtBottom1.Text); b.top = int.Parse(txtTop2.Text); b.bottom = int.Parse(txtBottom2.Text); c = fraction.Plus(a, b); txtTop3.Text = c.top.ToString(); txtBottom3.Text = c.bottom.ToString(); } else { c = new fraction(); } //========================= if (rdbSub.Checked == true) { a.top = int.Parse(txtTop1.Text); a.bottom = int.Parse(txtBottom1.Text); b.top = int.Parse(txtTop2.Text); b.bottom = int.Parse(txtBottom2.Text); c = fraction.Subtract(a, b); txtTop3.Text = c.top.ToString(); txtBottom3.Text = c.bottom.ToString(); } else { c = new fraction(); } //======================== if (rdbMult.Checked == true) { a.top = int.Parse(txtTop1.Text); a.bottom = int.Parse(txtBottom1.Text); b.top = int.Parse(txtTop2.Text); b.bottom = int.Parse(txtBottom2.Text); c = fraction.Multilpe(a, b); txtTop3.Text = c.top.ToString(); txtBottom3.Text = c.bottom.ToString(); } else { c = new fraction(); } if (rdbDivi.Checked == true) { a.top = int.Parse(txtTop1.Text); a.bottom = int.Parse(txtBottom1.Text); b.top = int.Parse(txtTop2.Text); b.bottom = int.Parse(txtBottom2.Text); if (b.top != 0 && b.bottom != 0) { c = fraction.Div(a, b); txtTop3.Text = c.top.ToString(); txtBottom3.Text = c.bottom.ToString(); } else { MessageBox.Show(" | Please check|", "Declare", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { c = new fraction(); } }