This is a calculator developed for the freeCodeCamp Front End Certificate. Allows multiple arithmetic operations and calculates result with recursive algorithm.
This is a stand alone single page app, all external libraries needed are either included as files on the repo or via CDN
- Build a CodePen.io app that is functionally similar to this
- User Story: I can add, subtract, multiply and divide two numbers
- User Story: I can clear the input field with a clear button.
- User Story: I can keep chaining mathematical operations together until I hit the equal button, and the calculator will tell me the correct output.
Code:
- uses module pattern to make the calculator reusable
- uses recursive algorithm to evaluate expression
Fulfillment of Requirements:
- allows + - * / operations
- "CE" button: clears current input (main screen only)
- "AC" button: resets calculator (main and sub screen)
- allows chaining of multiple operations together
- "main screen": current operand or operator
- "sub screen": current set of operations being inputted
Extra features:
- allows chaining of result. i.e. result of operation can be reused as operand for the next
- allows operations with floats
- Can provide a negative result but, if the result is reused in a subsequent operation the output is 'NaN'
Desktop view, multiple operations including a float number
Mobile view, multiple operations all with floats
- jQuery 3.2.1
- Bootstrap 3.3.7 CSS
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License