ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

C# : MDAS Calculator

MDASCSHARPfig.3

Now, in this tutorial, I will show you how to create MDAS calculator in C#. MDAS are the four fundamental operations in the calculation which stand for Multiplication, Division, Addition and Subtraction that are very common to remember, sounds good right? So, if you want to create your own MDAS calculator? These easy steps below will guide you on how to do it.

 

Let’s begin:

 

Open Microsoft Visual Studio 2008 and create a new windows form application. After that, do the form as follows.

MDASCSHARPfig.1

Go to the solution explorer, hit the “code view” to fire the code editor.

MDASCSHARPfig.2

In the code editor, declare a variable to represent the total of the MDAS.

 double total = 0;

Do the following codes for Multiplication methods.

 private void btnMultiply_Click(object sender, EventArgs e)
 {
 //set a formula for multiplication
 total = double.Parse (txtFinput.Text) * double.Parse (txtSinput.Text);
 //add the answer in the listbox
 lstOutput.Items.Add(double.Parse (txtFinput.Text) + " * " + double.Parse (txtSinput.Text) + " = " + total);
 }

Do the following codes for Division methods.

private void btnDivide_Click(object sender, EventArgs e)
 {
 //set a formula for Division
 total = double.Parse(txtFinput.Text) / double.Parse(txtSinput.Text);
 //add the answer in the listbox
 lstOutput.Items.Add(double.Parse(txtFinput.Text) + " / " + double.Parse(txtSinput.Text) + " = " + total);
 }

Do the following codes for Addition methods.

 private void btnAdd_Click(object sender, EventArgs e)
 {
 //set a formula for addition
 total = double.Parse(txtFinput.Text) + double.Parse(txtSinput.Text);
 //add the answer in the listbox
 lstOutput.Items.Add(double.Parse(txtFinput.Text) + " + " + double.Parse(txtSinput.Text) + " = " + total);
 }

Do the following codes for Subtraction methods.

 private void btnSubtract_Click(object sender, EventArgs e)
 {
 //set a formula for subtraction
 total = double.Parse(txtFinput.Text) - double.Parse(txtSinput.Text);
 //add the answer in the listbox
 lstOutput.Items.Add(double.Parse(txtFinput.Text) + " - " + double.Parse(txtSinput.Text) + " = " + total);
 }

Output:

MDASCSHARPfig.3

For all students who need a programmer for your thesis system or anyone who needs a source code in any programming languages. You can contact me @ :

 
Email – jannopalacios@gmail.com
Mobile No. – 09305235027 – TNT

 

 

Download Source Code

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!