This project is a simple calculator written in Java that can perform basic arithmetic operations (+, -, *, /). It also includes additional features such as clearing the display, deleting the last entered number, and changing the number format. The calculator utilizes the Swing library to create a user-friendly graphical user interface (GUI).
- Performs basic arithmetic operations (+, -, *, /).
- Clears the display.
- Deletes the last entered number.
- Changes the number format.
- Java 8 or higher
- Swing library
To run the calculator, follow these steps:
- Clone the GitHub repository to your local machine.
- Open the project in your favorite Java IDE.
- Locate and run the
Calculator.javafile.
Upon running the calculator, you will be presented with a graphical interface that resembles a typical calculator. Here's a breakdown of the different components and how to use them:
- Number Buttons: Press these buttons to enter numeric values.
- Operator Buttons: Use these buttons to select the desired arithmetic operation.
- Equals (=) Button: Press this button to perform the calculation and display the result.
- Clear Button: Clicking on this button will clear the entire display.
- Delete Button: Clicking on this button will remove the last entered digit or operator.
- Number Format Dropdown: Use this dropdown to change the number format (e.g., decimal, scientific notation).
To perform a calculation, follow these steps:
- Enter the first number using the number buttons.
- Select the desired arithmetic operation using the operator buttons.
- Enter the second number using the number buttons.
- Press the equals (=) button to display the result.