This is a Java-based console application that simulates a minimal e-commerce system.
- Define products with:
- Name, price, quantity
- Optional expiry date
- Optional weight for shipping
- Enforce validation rules via a rule-based system
- Calculate shipping cost based on product weight
- Print a full checkout invoice with itemized details
Product: Non-expirable, non-shippableExpirableProduct: Has expiry dateShippableProduct: Has shipping weightExpirableShippableProduct: Has both expiry and weight
The system validates the following:
- Product name must not be empty
- Price must be positive
- Quantity must not be negative
- Expirable products must have a future expiry date
- Shippable products must have weight > 0
- Cart items cannot exceed available product quantity
- Java 23
- Object-Oriented Design
- Rule-based validation
- Factory pattern for product creation
src/
ββ karim/
ββ models/
ββ rules/
ββ factories/
ββ services/user
ββ contracts/
ββ Main.java- Financial precision was considered by using BigDecimal for price calculations where needed.
- All rules are pluggable and reusable.
- Easily extendable for taxes, discounts, and more.
# clone the repository
git clone https://github.com/yourusername/EcommerceSimulationSystem.git
cd EcommerceSimulationSystem