Question: Extra Credit ( try if you have extra time ) Develop a calculator APP that can perform four arithmetic operations: addition + , subtraction -

Extra Credit (try if you have extra time)
Develop a calculator APP that can perform four arithmetic operations: addition +,
subtraction -, multiplication *, and division /. The GUI should look the same as the example
below.
A user can enter floating numbers and operations by clicking the
Buttons with corresponding digits, period, or operations. The
expression will show/update at the top Label of the APP after
each button is clicked.
When the Button "=" is clicked, the expression will be evaluated
to show the result.
The Button "CLEAR" will clear the display.
In addition, your program should be able to handle following error conditions:
(1) when a user input starts with an operator, your code should add a zero before it. For
example, the user starts with an empty display, then clicks +, the display should show:
0+
(2) when a user enters several operators, only the last one is shown and used. For example,
the user enters 5, then *, then +, the display should show: 5+
(3) when a user finishes the expression with an operator, and then clicks "=", the last
operand will be repeated. For example, the user enters "5.1+4.3**=", the expression will
be changed to "5.1+4.3**4.3=" for evaluation.
HINT: you can try the function eval() to evaluate an arithmetic expression, e.g. If the display
shows the string STR='2.1+3.4-1.33', calling eval(STR) will evaluate the expression and
give the result of 4.17.
Extra Credit ( try if you have extra time )

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 Programming Questions!