Question: please solve this using C# Your Task Your task for this assignment is to build a calculator app. One simple way for a calculator to

 please solve this using C# Your Task Your task for this

assignment is to build a calculator app. One simple way for a

calculator to work is as follows: - you enter the " x

please solve this using C#

Your Task Your task for this assignment is to build a calculator app. One simple way for a calculator to work is as follows: - you enter the " x " (or 1st operand) value - select an operator (i.e. +,,, or / ) - enter the " y " (or 2 nd operand) value - and click " = ". It computes and displays the result in the textbox. This means the app needs to remember the " x " value and the pending operator until you click the "=" sign. Use the following steps to implement a basic calculator app... 2. You need 3 private Form variables: a. x, which is the first operand b. pendingOperation, the operator to be applied between x and the next number c. isNewNumber, which is true when " = " has put a result into the textbox, and false as soon as a digit is clicked. 3. When a digit or decimal point is clicked (note: these can all use the same event handler): a. If isNewNumber is true, clear the textbox \& equation label, set isNewNumber to false b. Cast sender to a Button so you can append its Text to the textbox: i.e. ((Button)sender).Text c. Ignore a second decimal place if the textbox already has one. 4. The operator buttons move the textbox's value to x, clears the textbox, and sets pendingOperation to the operator displayed on the button. Again, these can all use the same event handler. 5. The "=" button's event handler has a switch (or a compound if-elseif), applying the pendingOperation between x (stored) and y (in the textbox). a. The result is placed in the textbox & appended to the label, x is set to zero, pendingOperation is cleared, and isNewNumber is set to true. 6. The "12 /5=2.4 " label above the textbox is obvious, right? The main question is not "how" ... it's "when" ... i.e. when are operands and operators appended to it? And when is it cleared? 7. C and CE (which is short for "clear entry") both clear the textbox, while C also clears the label above the textbox, then sets x to zero, pendingOperation to ", and isNewNumber tn true 1. Disable the textbox so that the number keys are the only way to enter operands. 2. You need 3 private Form variables: a. x, which is the first operand b. pendingOperation, the operator to be applied between x and the next number c. isNewNumber, which is true when "=" has put a result into the textbox, and false as soon as a digit is clicked. 3. When a digit or decimal point is clicked (note: these can all use the same event handler): a. If isNewNumber is true, clear the textbox \& equation label, set isNewNumber to false b. Cast sender to a Button so you can append its Text to the textbox: i.e. ((Button)sender).Text c. Ignore a second decimal place if the textbox already has one. 4. The operator buttons move the textbox's value to x, clears the textbox, and sets pendingoperation to the operator displayed on the button. Again, these can all use the same event handler. 5. The "=" button's event handler has a switch (or a compound if-elseif), applying the pendingOperation between x (stored) and y (in the textbox). a. The result is placed in the textbox & appended to the label, x is set to zero, pendingOperation is cleared, and isNewNumber is set to true. 6. The "12 /5=2.4 " label above the textbox is obvious, right? The main question is not "how" ... it's "when" ... i.e. when are operands and operators appended to it? And when is it cleared

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!