Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
charakamihiranga authored Jun 14, 2024
1 parent 513f9e1 commit 1844138
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Calculator

A simple and user-friendly calculator web application that supports basic arithmetic operations and complex calculations. The calculator can be operated using both mouse clicks and keyboard inputs.

## Features

- **Basic Arithmetic Operations**: Addition, Subtraction, Multiplication, and Division.
- **Parentheses Support**: Handle complex expressions using parentheses.
- **Percentage Calculations**: Support for percentage operations.
- **Clear (AC) and Backspace Functionalities**: Easily clear input or delete the last character.
- **Real-Time Input Display Formatting**: Clean and user-friendly input display.
- **Keyboard Support**: Convenient keyboard input for quick calculations.

## Installation

To use this calculator, clone the repository and open the `calculator.html` file in your web browser.

git clone https://github.com/CharakaMihiranga/calculator.git

cd calculator

open calculator.html

## Usage

### Mouse Input

Click the buttons on the calculator to input numbers and operations.

### Keyboard Input

You can also use the following keyboard keys to operate the calculator:

- `0-9`: Numbers
- `+`: Addition
- `-`: Subtraction
- `*`: Multiplication
- `/`: Division
- `%`: Percentage
- `(`, `)`: Parentheses
- `.`: Decimal point
- `Enter`: Equals
- `Backspace`: Delete the last character
- `Delete`: Clear the input

## File Structure

- `calculator.html`: The main HTML file that contains the structure of the calculator.
- `style/style.css`: The CSS file for styling the calculator.
- `js/script.js`: The JavaScript file containing the logic for the calculator.

## Code Overview

### HTML

The HTML file sets up the structure of the calculator. It includes buttons for each number and operation, and display areas for the input and output.

### CSS

The CSS file is used to style the calculator, making it visually appealing and user-friendly.

### JavaScript

The JavaScript file handles the logic of the calculator. It includes event listeners for button clicks and keyboard inputs, functions to validate and clean the input, and to prepare and display the output.

## Screenshots

Here are some screenshots of the calculator in action:

![Screenshot 2024-06-14 131525](https://github.com/CharakaMihiranga/Calculator/assets/143955766/4d8a9786-8056-4320-a595-647d434ca4a6)

![Screenshot 2024-06-14 131548](https://github.com/CharakaMihiranga/Calculator/assets/143955766/fc186e14-cfaf-4981-9347-0ff19cbc411d)

0 comments on commit 1844138

Please sign in to comment.