Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 516 Bytes

README.md

File metadata and controls

25 lines (19 loc) · 516 Bytes

Basic Calculator

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