Question: In Java, make a basic postfix calculator. This calculator should reside in a class called Calculator, which extends JFrame. To add listeners to buttons, use
In Java, make a basic postfix calculator. This calculator should reside in a class called Calculator, which extends JFrame. To add listeners to buttons, use the anonymous class strategy. For this basic calculator, for the buttons, you should simply add ActionListeners. The calculator should look like the one below. The dimensions are 160 x 260. The text area should not be editable, it should only display information from the button presses.
Being a postfix calculator, the first operation button you click will perform the selected operation on whatever input was entered and zero (the initial value for some variable in which to save input, say, currentResult). Thus, entering 20 * 10 +, the result should be 10 ((0 * 20) + 10). Entering 20 * 10 + 30 * should result in 300. Entering 10 + 20 *, on the other hand, should return 200 ((0 + 10) * 20).

4 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
