Modularized Node Calculator
Create a calculator program that takes 2 numbers and a string as inputs and can perform the following operations on those numbers:
- Addition
- Subtraction
- Multiplication
- Division
- Exponentiation (raise the first number to the power of the second number)
The 3rd string parameter represents which of the operations you want to perform on the two numbers.
The main calculator app should do all the business logic (i.e. figuring out which operation to perform based on the string in the 3rd input) and the individual functions that perform the specific operations should be require()
'd in from separate files, each operation in it's own file.
In addition, you should use at least 3 of the different module patterns from a list of possible modules patterns as described in the Node Module Patterns post. If you would like additional exposure and practice, try using all 5 of the listed module patterns.
Like many of the exercises we do, this one is a bit contrived (you probably wouldn't want to choose different module patterns for the same kind of functionality, and you may decide it's better to put all these operations in a single file that handles them), but you'll be doing it this way in this exercise purely for practices' sake.