Calculator
An electronic calculator is typically a portable electronic device used to perform calculations, ranging from basic arithmetic to complex mathematics.
Checklist
- Your demo and repository URLs are correct.
- You have completed all of the user stories.
- Your site is deployed up and running.
- Sensitive data is not publicly visible.
An electronic calculator is typically a portable electronic device used to perform calculations, ranging from basic arithmetic to complex mathematics. In this problem you will create a calculator that supports basic arithmetic calculations on integers.
Constraints
Do not use the eval()
function to execute calculations
User Stories
User can see a display showing the current number entered or the result of the last operation.
User can see an entry pad containing the following buttons:
Digits 0-9
Operations (addition, subtraction, multiplication, division)
Equal
AC
User can click on an operation button to display the result of that operation on:
the result of the preceding operation and the last number entered OR
the last two numbers entered OR
the last number entered
User can click the 'AC' button to clear all internal work areas and to clear the display.
User can see 'ERR' if the user tries to divide by 0.
Bonus features
User can click a '+/-' button to change the sign of the number that is currently displayed.
User can see a decimal point ('.') button on the entry pad to that allows floating point numbers up to 3 places to be entered and operations to be carried out to the maximum number of decimal places entered for any one number.
Add a “backspace” button, so the user can undo if they click the wrong number.
Add keyboard support.