Manually implement the following functions to provide the calculator with basic functionality:
- add
- subtract
- multiply
- divide
- getResult
- clear note: make the provided API to be encapsulated. Basic usage:
calculator.add(5); calculator.add(7); calculator.getResult(); // 12
Implement each function the way so each one can take endless arguments or simply an array example calculator.add(5); calculator.getResult(); // 5
calculator.add(5, 6, 2); calculator.getResult(); // 13