Calculator:



Calculator:

Originally started as a 3 textbox version. Enter the numbers you want to calculate in boxa and boxb, press answer button and answer appears in boxc. Wanted to be a more conventional calculator so introduced a textbox that built the expression and then when the answer button is pressed the answer appears in the answer box. I thought this was abetter way of setting it out as it allowed the user to have a longer more complex expression.

The next problem was using functions such as cos, sin and tan. The prewritten code in Javascript is Math.sin(), Math.cos() and Math.tan(). If used in the visible textbox then it could confuse the user and would look untidy. Found a replace function that runs through the expression to be evaluated and replaces any sins, cos’ or tans with the correct Math.??? function. This process also worked for functions such as Pi and square root. An issue with this process was when it tried to evaluate arcsin(), cos, tan etc. It used the previous rule and confused the calculator so no answer was evaluated.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download