The first application to be created is a simple calculator. A JavaBean named CalculatorBean is included to provide the basic mathematical operations on two integer (long) numbers.
This bean has five properties:
The bean also has associated getter and setter methods for all of its properties. In addition, the calculate() method calculates the result of one of the following operations:
The result is stored in the first number (operand 1) for subsequent operations. If a division does not result in an integer, an exception is thrown. Finally, a toString() method displays the numbers and the operation.