Design and code an applet calculator. Your calculator will have two text fields that the user cannot change: One labeled "Result" will contain the result of performing the operation, and the other labeled " Operand" will be for the user to enter a number to be added, subtracted, and so forth from the result. The user enters the number for the "Operand" text field by clicking buttons labeled with the digits o through 9 and a decimal point, just as in a real calculator. Allow the operations of addition, subtraction, multiplication, and division. Use a GridLayout manager to produce a button pad that looks similar to the keyboard on a real calculator.
When the user clicks a button for an operation, the following occurs: The operation is performed, the "Result" text field is updated, and the "Operand" text field is cleared. Include a button labeled "Reset" that resets the "Result" to 0.0. Also include a button labeled "Clear" that resets the "Operand" text field so it is blank.
Hint: Define an exception class named DivisonByZeroException. Have your code throw and catch a DivisonByZeroException if the user attempts to "divide by zero." Your code will catch the DivisonByZeroException and output a suit-able message to the "Operand" text field. The user may then enter a new substitute number in the "Operand" text field. Because values of type double are, in effect, approximate values, it makes no sense to test for equality with 0 . 0. Consider an operand to be "equal to zero" if it is in the range –1 . 0e –10 to +1 . 0e –10.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.