This is a simple Java library that provides basic arithmetic operations. The library is designed to be easy to use and includes the following functionality:
- Addition
- Subtraction
- Multiplication
- Division
To use this library, you can include the JAR file in your Java project. You can either build the JAR file from the provided source code or download a pre-built JAR file. Here are the steps for both options:
-
Clone or download this repository to your local machine.
-
Open a terminal or command prompt and navigate to the project directory.
-
Build the JAR file using Maven by running the following command:
./mvnw clean package
-
The JAR file will be generated in the
target
directory of the project. -
Add the JAR file to your Java project as an external library.
-
Build the javadoc files using Maven by running the following command:
./mvnw clean javadoc:javadoc
-
The javadoc files will be generated in the
target/site/apidocs
directory of the project and open index.html -
Build all and publish to local sonar
./mvnw clean test jacoco:report -Dmaven.test.failure.ignore=true sonar:sonar
-
Visit the releases page on this repository.
-
Download the latest release JAR file.
-
Add the downloaded JAR file to your Java project as an external library.
Here's a quick guide on how to use the Calculator library in your Java project:
-
Import the
Calculator
class in your Java file:import com.levik.Calculator;
-
Create an instance of the
Calculator
class:Calculator calculator = new SimpleCalculator();
-
Use the provided methods for arithmetic operations:
int sum = calculator.add(5, 3); int difference = calculator.subtract(10, 4); int product = calculator.multiply(6, 7); double quotient = calculator.divide(8, 2);
-
You can now use the calculated results in your application as needed.
Here's an example of using the Calculator library in a simple Java program:
import com.example.Calculator;
public class Main {
public static void main(String[] args) {
Calculator calculator = new Calculator();
int sum = calculator.add(5, 3);
int difference = calculator.subtract(10, 4);
int product = calculator.multiply(6, 7);
double quotient = calculator.divide(8, 2);
System.out.println("5 + 3 = " + sum);
System.out.println("10 - 4 = " + difference);
System.out.println("6 * 7 = " + product);
System.out.println("8 / 2 = " + quotient);
}
}
This Calculator library is provided under the MIT License. Feel free to use, modify, and distribute it as needed. If you find any issues or have suggestions for improvements, please open an issue on this repository.
If you have any questions or need assistance, please feel free to contact the author:
Author: Your Name Email: your@email.com GitHub: Your GitHub Profile