Sales Taxes application is developed using Java. Here, the application takes receipt file for various types of products and then print out the receipt details by including tax as per condition on certain goods. Types of taxes applicable to goods are Basic Sales Tax and Additional Sales Tax. Basic sales tax is applicable at a rate of 10% on all goods, except books, food, and medical products that are exempt. Additional sales tax is applicable on all imported goods at a rate of 5%, with no exemptions.
Tools and Technologies used:
- Java
- Maven
- Docker
- Log4j2
- Lombok
- Junit
- Install Java 8 and Maven.
- Clone the repo or download the code as zip file using the link.
- Run the command:
mvn clean package
to install all the required dependencies. - Once the build is successful, executable JAR file is created under
/target
folder with namesales-taxes-jar-with-dependencies.jar
. - You can run the application either by running the JAR file created in Step 4 or by running the application directly from IDE.
- By default, one particular receipt file is selected as input file, but this file can be overridden by passing your desired file. For this you have to pass your desired filepath as program arguments while running application from IDE or while executing JAR file.
- In order to get idea about format of input file as receipt file, refer to
shoppingbaskets directory under
/src/main/resources
section.
Executing JAR File:
java -jar sales-taxes-jar-with-dependencies.jar <FILE_PATH>
- Note: Here,
<FILE_PATH>
is optional. - Example:
java -jar target/sales-taxes-jar-with-dependencies.jar shoppingbaskets/inputThird.txt
Executing Docker Image:
- Navigate to directory where
Dockerfile
is located. - Build the Docker image using Dockerfile:
docker build -t sales-taxes-calculator .
- Run the Docker image:
docker run sales-taxes-calculator <FILE_PATH>
. Here <FILE_PATH> is optional. Example:docker run sales-taxes-calculator shoppingbaskets/inputThird.txt