https://github.com/wwi2196/simple-calculator-application
A Java-based Calculator Application featuring Simple and Programming modes. The Simple Calculator performs basic arithmetic and memory functions, while the Programming Calculator supports multiple number bases (Binary, Octal, Decimal, and Hexadecimal), built using Java Swing.
https://github.com/wwi2196/simple-calculator-application
Last synced: 3 months ago
JSON representation
A Java-based Calculator Application featuring Simple and Programming modes. The Simple Calculator performs basic arithmetic and memory functions, while the Programming Calculator supports multiple number bases (Binary, Octal, Decimal, and Hexadecimal), built using Java Swing.
- Host: GitHub
- URL: https://github.com/wwi2196/simple-calculator-application
- Owner: WWI2196
- License: apache-2.0
- Created: 2024-10-14T06:30:21.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-10-14T06:37:04.000Z (8 months ago)
- Last Synced: 2025-01-29T22:45:01.034Z (4 months ago)
- Language: Java
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java Calculator Application
This is a Java-based graphical user interface (GUI) calculator application designed to operate in two modes: **Simple Calculator** and **Programming Calculator**. The application is implemented using Java Swing components, and it follows good coding practices and algorithms.
## Features
### Simple Calculator
The Simple Calculator mode supports basic arithmetic operations and memory functions. The operations include:
- **Digits (0-9)**: Display the selected digit in the text field.
- **Basic Operations**:
- `+` Addition
- `-` Subtraction
- `×` Multiplication
- `/` Division
- `=` Equals (Performs the displayed operation)
- **Memory Operations**:
- `M` Displays the current memory value.
- `M+` Adds the displayed value to the memory.
- `M-` Subtracts the displayed value from the memory.
- `MC` Clears the memory.
- **Clear Operation**: `CL` Clears the content in the display field.#### Error Handling:
The Simple Calculator identifies and handles common errors such as:
- Two consecutive operations (e.g., `10/+20`).
- Division by zero (e.g., `34/0`).
- Consecutive memory operations (e.g., `10M+M+` or `30M-M+`).### Programming Calculator
The Programming Calculator mode is designed for working with different numerical bases:
- **Supported Bases**: Binary, Octal, Decimal, Hexadecimal.
- **Numerical Buttons**: Digits (0-9), Alphabetical buttons (A-F) for Hexadecimal.
- **Operations**:
- `+` Addition
- `×` Multiplication
- `=` Equals (Executes the operation)
- **Radio Buttons**: Select the base (Binary, Octal, Decimal, Hexadecimal) and enable the corresponding digit buttons.
- **Number Conversion**: Displays the entered number in the selected base in bold, while converting it to other bases and displaying them in regular font.
- **Clear Operation**: `CL` Clears the content in the display field.### Menu Bar
The application allows switching between the **Simple Calculator** (default) and **Programming Calculator** modes using the menu bar.