This codebase implements a Calculator using ReactJs.
📝 This repository uses git-lfs to manage large and binary files (like the image above). In case you do not see this image locally, please run
git lfs pull
Please use npm i followed by npm start to run the application in the development mode:
Open http://localhost:3000 to view it in the browser.
Much thought has gone into adding enough features while maintaining a rather small scope and not introducing uncessary complexities (f.e. state management).
The application allows for:
- Choosing 2 sets of numbers (second set, after an operator is selected),
- Performing following operators on the mentioned sets:
- Adding,
- Substracting,
- Multiplying,
- Dividing,
- Percentile,
- Inverting,
- Adding decimal,
- Calculating,
- Resetting.
- Resetting a completed calculation with a tap on any number.
Those elements should be working as expected and guarding user from possible errors:
- Dividing by 0,
- Going over the result Screen (due to the amount of digits),
- Changing operators after the calculation has been concluded.
This assignment has been rated for couple of hours, so not much can be added in the timespan allocated. Still the elemenents I would like to add:
- Possibility of typing in numbers in the Screen input,
- Scaling of the Screen text based on the result to accomodate for more digits,
- Better styles across the entire Calculator instance (f.e. color coding different options like operations),
- Possibility of substracting the last digit from the value,
- Unit Tests around the logic in the application.
