This is a Spring Boot-based Java calculator application that processes mathematical expressions and returns computed results. The project follows a structured MVC (Model-View-Controller) architecture with DTOs for data representation.
- Supports basic arithmetic operations
- REST API-based communication
- Well-structured DTOs and services
- Configurable settings through
application.properties - Unit and integration tests
java-calculator-budati/
│── src/
│ ├── main/
│ │ ├── java/com/budati/calculator/
│ │ │ ├── config/ (Application Configuration)
│ │ │ ├── controller/ (API Controllers)
│ │ │ ├── dto/ (Data Transfer Objects)
│ │ │ ├── service/ (Business Logic)
│ │ │ ├── CalculatorApplication.java (Main Spring Boot Class)
│ ├── test/
│ │ ├── java/com/budati/calculator/ (Unit & Integration Tests)
│── pom.xml (Maven Dependencies)
│── application.properties (Configurable properties)
- Java 17+
- Maven 3.8+
- (Optional) Docker for containerized execution
- Clone the Repository
git clone https://github.com/your-repo/java-calculator-budati.git cd java-calculator-budati - Build the Project
mvn clean install
- Run the Application
mvn spring-boot:run
- Access API Endpoints
- Base URL:
http://localhost:8080 - Sample API Call:
curl -X POST "http://localhost:8080/calculate" -H "Content-Type: application/json" -d '{"expression": "2+3*4"}'
- Base URL:
| Method | Endpoint | Description |
|---|---|---|
| POST | /calculate |
Processes a mathematical expression |
Below is a high-level flowchart representing the application's request flow:
User Request --> ComputationalController --> Service Layer --> Expression Parsing & Calculation --> Response to User
To execute unit tests, run:
mvn testTo run the application inside a Docker container:
docker build -t java-calculator .
docker run -p 8080:8080 java-calculatorFeel free to fork the repository and submit pull requests for improvements!
This project is licensed under the MIT License.