Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculator using react #2

Merged
merged 3 commits into from Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions the calculator/README.md
@@ -0,0 +1,34 @@
# The Calculator
#### Project made for freeCodeCamp "Front End Libraries Projects" module

This is a project made for FreeCodeCamp in which it was required to code a calculator from scratch. Made using React.

#### Screenshot

This is how it looks like.

![Screenshot](Screenshot.png "Screenshot")

#### User Stories

These are the requirements for this project. They are all fullfilled.

1. My calculator should contain a clickable element containing an = (equal sign) with a corresponding id="equals".
2. My calculator should contain 10 clickable elements containing one number each from 0-9, with the following corresponding IDs: id="zero", id="one", id="two", id="three", id="four", id="five", id="six", id="seven", id="eight", and id="nine".
3. My calculator should contain 4 clickable elements each containing one of the 4 primary mathematical operators with the following corresponding IDs: id="add", id="subtract", id="multiply", id="divide".
4. My calculator should contain a clickable element containing a . (decimal point) symbol with a corresponding id="decimal".
5. My calculator should contain a clickable element with an id="clear".
6. My calculator should contain an element to display values with a corresponding id="display".
7. At any time, pressing the clear button clears the input and output values, and returns the calculator to its initialized state; 0 should be shown in the element with the id of display.
8. As I input numbers, I should be able to see my input in the element with the id of display.
9. In any order, I should be able to add, subtract, multiply and divide a chain of numbers of any length, and when I hit =, the correct result should be shown in the element with the id of display.
10. When inputting numbers, my calculator should not allow a number to begin with multiple zeros.
11. When the decimal element is clicked, a . should append to the currently displayed value; two . in one number should not be accepted.
12. I should be able to perform any operation (+, -, *, /) on numbers containing decimal points.
13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered.
14. Pressing an operator immediately following = should start a new calculation that operates on the result of the previous evaluation.
15. My calculator should have several decimal places of precision when it comes to rounding (note that there is no exact standard, but you should be able to handle calculations like 2 / 7 with reasonable precision to at least 4 decimal places).

---

[Peanut](https://github.com/PeanutCoffee)
Binary file added the calculator/Screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.