A simple calculator written in Java, designed to perform basic mathematical operations.
- Basic arithmetic operations: addition, subtraction, multiplication, and division.
- Modular implementation for easy extensibility.
- Exception handling for invalid operations.
- Automated testing with JUnit for reliability.
Before getting started, make sure you have installed:
- Java 17 or later
- Maven for dependency and build management
- Git (optional, for cloning the repository)
To run the project locally:
-
Clone the repository:
git clone https://github.com/marioreste/calculator.git cd calculator -
Build and run tests using Maven:
mvn clean install
-
Run the application:
java -jar target/calculator-1.0-SNAPSHOT.jar
The project follows a standard Maven structure:
calculator/
│-- src/
│ ├── main/java/com/example/calculator/ # Main source code
│ ├── test/java/com/example/calculator/ # Unit tests
│-- pom.xml # Maven configuration file
│-- README.md # Documentation
The project follows coding style guidelines enforced using Checkstyle. The Checkstyle configuration can be found in the checkstyle.xml file. To run Checkstyle, use the following command:
mvn checkstyle:checkEnsure that your code adheres to the specified coding standards before submitting contributions.
The project uses Maven for dependency management. Below are some key dependencies defined in pom.xml:
<dependencies>
<dependency>
<groupId>net.sourceforge.jeval</groupId>
<artifactId>jeval</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/feature-name). - Make your changes and commit them (
git commit -m 'Added new feature'). - Push the branch (
git push origin feature/feature-name). - Open a Pull Request for review.
This project is licensed under the MIT license. See the LICENSE file for more details.
For any questions or suggestions, contact me at [email protected].