Skip to content

khalidKE/Ecommerce_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸ›’ Fawry Rise Journey – Full Stack Internship Challenge

## πŸ“Œ Overview

This is a Java-based implementation of a simplified **e-commerce system** developed for the **Fawry Rise Journey – Full Stack Development Internship Challenge**.

The system allows customers to:
- Add products to a shopping cart
- Perform a checkout with proper validation
- Handle expired items, stock limits, and shipping
- View printed checkout and shipping details as per challenge specification

---

## βœ… Features

### πŸ”Έ Product System
- Each product includes:
  - `name`
  - `price`
  - `quantity`
  - `expired` status
- Products may:
  - Expire (e.g., Cheese, Biscuits)
  - Require shipping (e.g., Cheese, TV) with `weight`
  - Or neither (e.g., Scratch Cards)

### πŸ”Έ Cart Management
- Users can:
  - Add products with specific quantity (must not exceed stock)
  - Calculate subtotal and shipping weight
- Validates:
  - Product existence
  - Quantity > 0
  - Stock availability

### πŸ”Έ Checkout Process
- Displays:
  - Shipment notice: Shippable items and their weights
  - Checkout receipt: Quantity, product names, total prices
- Verifies:
  - Cart is not empty
  - Products are not expired
  - Customer has enough balance
- Performs:
  - Stock deduction
  - Balance deduction

---

## πŸ§ͺ Sample Usage

```java
Product cheese = new ShippableProduct("Cheese", 100, 10, false, 0.2);
Product biscuits = new ShippableProduct("Biscuits", 150, 5, false, 0.7);
Product scratchCard = new SimpleProduct("Scratch Card", 50, 20, false);

Customer customer = new Customer("Ali", 1000);

Cart cart = new Cart();
cart.add(cheese, 2);
cart.add(biscuits, 1);
cart.add(scratchCard, 1);

CheckoutService.checkout(customer, cart);

βœ… Console Output (Expected)

** Shipment notice **
2x Cheese        
400g
1x Biscuits      
700g
Total package weight 1.1 kg

** Checkout receipt **
2x Cheese        
200
1x Biscuits      
150
1x Scratch Card  
50
Subtotal 400
Shipping 30
Amount 430

πŸ› οΈ How to Run

  1. Open the project in a Java IDE (IntelliJ, Eclipse, etc.) or compile via terminal:
javac FawryChallenge.java
java FawryChallenge
  1. The program will print test case results to the console.

πŸ” Assumptions

  • Shipping fee is fixed at 30 units if any item in the cart requires shipping.
  • Weight is handled in kilograms but printed in grams.
  • Prices are printed without decimal places (rounded).
  • If the cart is empty or any product is expired/out of stock, an error is thrown.

βœ… Implemented Validations

  • βœ”οΈ Product name, price, quantity, weight must be valid

  • βœ”οΈ Customer must have non-negative balance

  • βœ”οΈ No checkout allowed if:

    • Cart is empty
    • Product is expired
    • Stock is insufficient
    • Balance is insufficient

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages