This Java project is an implementation of the coding challenge described at Kata09: Back to the Checkout.
- Flexible Pricing Rules: Easily configure pricing rules for each product in the database.
- Scalable Design: Add new products and pricing schemes without altering existing code.
- Robust Testing: Ensures the reliability of the checkout system through test coverage.
- Java 8 or later.
- Gradle for building and running the project.
-
Clone the repository:
git clone https://github.com/mpgallage/Kata09.git
-
Navigate to the project directory:
cd Kata09
-
Build the project using Gradle:
.gradlew clean build
-
Run tests using Gradle:
.gradlew test
The database contains a single table named PricingRules
. This table is designed to store pricing information for various products, identified by their Stock Keeping Unit (SKU).
Column | Data Type | Description |
---|---|---|
SKU |
CHAR(1) | Primary key. A unique identifier for each product. |
UnitPrice |
DECIMAL(10, 2) | The standard unit price of the product. |
DiscountUnits |
INTEGER(3) | The quantity of items required for a discount. |
DiscountPrice |
DECIMAL(10, 2) | The total price for the discounted quantity. |
Initial data is populated into the PricingRules
table as follows:
- SKU 'A': Priced at $50 each, with a special deal of 3 for $130.
- SKU 'B': Priced at $30 each, with a special deal of 2 for $45.
- SKU 'C': Priced at $20 each, with no special discount.
- SKU 'D': Priced at $15 each, with no special discount.
The database is stored in a SQLite file named checkout.sqlite
inside the project directory.
Distributed under the MIT License. See LICENSE
for more information.
Malaka Gallage - [email protected]
Project Link: https://github.com/mpgallage/Kata09