🛒

DUKKAN

2024 — Supermarket Inventory Management System (Java)

About

A Java console application for managing supermarket inventory. Built as part of the Java Programming course at University of Khartoum. Features item management, stock tracking, buy/sell operations, and reporting.

"Dukkan" (دكان) means "shop" or "small store" in Arabic.

💻 Running the App

$ java -cp out dukkan.Dukkan

How Can We Help You? (Select 1-8):
1. Add new items to the stock
2. Search for specific item
3. Inquiry about price
4. Inquiry about quantity
5. Sell items
6. Buy items
7. Report all items
8. Exit

Select Number: 7

The Current Stock
Name        Price       Quantity
---------------------------------
alwtania    300         500
almoshrf    200         200
alrawdaa    100         400
brkaBisc    250         100
royalBis    150         150

✨ Features

📦

Inventory Management

Add, search, and track items in stock with name, price, and quantity.

💰

Buy & Sell

Process purchases (add to stock) and sales (reduce stock) with validation.

🔍

Search & Query

Find items by name, check prices, and query available quantities.

📊

Stock Reports

Generate complete inventory reports showing all items and their status.

📁 Code Structure

Dukkan.java

Main class with menu loop and user interaction

items.java

Item model class (name, price, quantity)

use_item.java

Business logic (CRUD operations on stock)

Code Sample: Selling Items

static void sale_items(String name, int quantity) {
    for (items item : stock) {
        if (item.item_name.equalsIgnoreCase(name)) {
            if (quantity < item.item_quantity) {
                System.out.println("Sale Successful");
                item.item_quantity -= quantity;
            } else {
                System.out.println("Not enough Quantity");
                System.out.println("Available: " + item.item_quantity);
            }
            return;
        }
    }
    System.out.println("Item Not Found");
}

🚀 How to Run

  1. 1 Clone: git clone https://github.com/Asimawad/DUKKAN.git
  2. 2 Compile: javac -d out src/dukkan/*.java
  3. 3 Run: java -cp out dukkan.Dukkan

What I Learned

  • • Object-Oriented Programming: Classes, objects, encapsulation
  • • Java Collections: ArrayList for dynamic inventory storage
  • • User Input: Scanner for interactive console applications
  • • Control Flow: Switch statements, loops, conditionals
  • • Basic CRUD operations on in-memory data structures

Tech Stack

Java OOP ArrayList NetBeans