A simple yet modern calculator built using Java Swing for the Object-Oriented Programming (OOPS) mini project in college. It supports basic arithmetic operations, square roots, exponentiation, and modulus, along with keyboard input for an enhanced user experience.
This calculator supports interactive functionality through both GUI buttons and keyboard inputs, making it easy to use for all types of users.
- Basic Arithmetic Operations - Addition, subtraction, multiplication, division.
- Square Root Calculation - Computes the square root of a number.
- Exponentiation - Raise a number to a power (
^). - Percentage Calculation - Calculate percentages and modulus.
- Keyboard Input - Supports keyboard shortcuts for entering numbers and operations.
- Clear Button (
C) - Clears the display using either the button or the C key on the keyboard. - Result Calculation (
=) - Computes the result by pressing the Enter key or the=button. - Backspace - Removes the last entered character using the Backspace key.
- Java - Object-Oriented Programming (OOP) principles.
- Java Swing - For the graphical user interface (GUI).
- Event Handling - For handling user interactions via both mouse clicks and keyboard events.
Follow these instructions to get a copy of the project up and running on your local machine:
# Clone the repository
git clone https://github.com/Roshan-Bhadane/Calculator_in_Java.git
# Navigate to the project directory
cd Calculator_in_Java
# Compile and run the project
javac ModernCalculator.java
java ModernCalculatorβββ ModernCalculator.java # Main Java source file
βββ README.md # Project documentation
βββ LICENSE # MIT License file (optional)
- Launch the application.
- Use the GUI buttons or keyboard to enter numbers and operators.
- Press the C button or C key to clear the display.
- Press the Enter key or = button to calculate the result.
- Press the Backspace key to delete the last entered character.
- Enter - Calculate the result (same as clicking
=) - Backspace - Delete the last entered character
- C - Clear the display
Hereβs a screenshot of the Modern Java Calculator:
Contributions are welcome! If you'd like to suggest improvements or contribute code, please fork the repository and create a pull request with your changes. You can also open issues to report bugs or suggest new features.
