Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

This project is a simple scientific calculator built with HTML, CSS, and JavaScript. The calculator provides both basic arithmetic operations and advanced scientific functions, including trigonometric calculations, exponents, and square roots.

Features

  • Basic arithmetic operations: addition, subtraction, multiplication, and division.
  • Scientific operations: exponentiation, trigonometric functions (sin, cos, tan), and square roots.
  • Use of the mathematical constant π (Pi).
  • Advanced mode for trigonometric and scientific functions that can be toggled on and off.
  • History panel to keep track of previous calculations.
  • Keyboard input support for better user experience.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/FreecssY/Calculator.git
  2. Navigate into the project directory:

    cd Calculator
  3. Open the public/index.html file in your preferred web browser to use the calculator.

Usage

  • Click on the buttons to enter numbers and operations, or use your keyboard for input.
  • Use the "Advanced" button to toggle additional functions like sin, cos, tan, square root, and exponentiation.
  • The calculator history displays the last few calculations and can be adjusted in size.
  • Use the backspace button (←) to delete the last character or operation.
  • The "C" button clears the entire display.

Keyboard Shortcuts

  • Numbers: 0-9
  • Decimal point: .
  • Basic operators: +, -, *, /
  • Exponentiation: ^
  • Trigonometric functions: Type "sin", "cos", or "tan" and press enter.
  • Square root: Type "sqrt(" followed by the number and closing parenthesis ).
  • Pi (π): Type "pi"
  • Backspace: Backspace
  • Calculate: Enter
  • Clear display: Escape

Project Structure

calculator/
├── index.js
├── package.json
├── package-lock.json
├── public
│   ├── index.html
│   ├── script.js
│   └── styles.css
├── README.md
└── routes
    └── calculator.js

3 directories, 8 files

Live Preview

A live preview of the calculator is available here: Live Preview

Customization

You can customize the calculator by modifying the CSS for different styles or enhancing the JavaScript code to add more features such as logarithms or factorial calculations.

License

This project is open-source and available under the MIT License. You are free to use, modify, and distribute this project.

Contributing

Contributions are welcome! If you'd like to add more features or improve the project, feel free to fork the repository and submit a pull request.

Acknowledgments

  • This project was built as a learning exercise for JavaScript, HTML, and CSS.
  • Inspired by classic scientific calculators with an easy-to-use interface.

Contact

For any inquiries, please contact freecssy31@gmail.com.

About

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages