A Java-based simulation of India's Public Distribution System (PDS), built as an academic project demonstrating core Data Structures & Algorithms and Object-Oriented Programming concepts through a real-world government welfare use case.
The Digital Ration Distribution System models the workflow of a government Fair Price Shop (FPS) under the National Food Security Act (NFSA), 2013. It supports beneficiary management, regional inventory tracking, two-factor authentication (Aadhar + OTP), and a priority-based ration distribution queue — all implemented from scratch using fundamental DSA concepts.
Two implementations are included:
| Implementation | Description |
|---|---|
RationDistributionSystem.java |
Console-based driver demonstrating all DSA operations |
RationUI.java |
Java Swing GUI with full 3-step authentication flow and interactive dashboard |
- Step 1 — RCID Lookup: Beneficiary verified via Ration Card ID using linear search on a linked list
- Step 2 — Aadhar Verification: Last 4 digits of Aadhar matched against stored records (max 3 attempts)
- Step 3 — OTP Verification: Time-based 4-digit OTP (2-minute expiry, 3-attempt limit) with resend support and masked phone display
- Add, search, and delete beneficiaries stored in a custom Singly Linked List
- Register new beneficiaries with full validation (Aadhar, phone, RCID uniqueness check)
- Sort beneficiaries by priority (Antyodaya > BPL > APL), area, or name
- Per-state inventory stored in a static array (
Inventory[]) - Linear search for item lookup
- Threshold alerts with inline restocking support
- Regional allocation rates (Punjab/Haryana favour wheat; West Bengal/Kerala favour rice)
- FIFO Queue (
LinkedList) for pending beneficiaries - LIFO Stack (
Stack) for completed distributions (most recent first) - Live status tracking:
PENDING/COMPLETED/NOT FOUND - Priority-sorted enqueue (Antyodaya families served first)
| Algorithm | Applied To | Complexity |
|---|---|---|
| Linear Search | Linked list (by RCID) | O(n) |
| Binary Search | Sorted RCID array | O(log n) |
| Bubble Sort | Sort by priority / area | O(n²) |
| Insertion Sort | Sort by name | O(n²) |
| Concept | Where Used |
|---|---|
| Abstraction | Person abstract class with displayDetails() |
| Inheritance | Customer extends Person |
| Encapsulation | Private fields with getters in all classes |
| Polymorphism | @Override displayDetails() in Customer |
| Structure | Class | Purpose |
|---|---|---|
| Static Array | Shop |
Fixed-capacity inventory (Inventory[]) |
| Singly Linked List | BeneficiaryList, Node |
Beneficiary records |
| Queue (FIFO) | DistributionQueue |
Distribution waiting list |
| Stack (LIFO) | DistributionQueue |
Completed distributions history |
| HashMap | OTPManager, Shop |
OTP store, allocation rates, Aadhar map |
📁 DigitalRationSystem/
├── RationDistributionSystem.java # Console driver (all DSA demos)
├── RationUI.java # Swing GUI application
├── goi_logo.jpg # (Optional) Government of India logo
├── pm_image.jpg # (Optional) Prime Minister image
└── README.md
All classes (
Person,Customer,Inventory,Shop,BeneficiaryList,Node,DistributionQueue,SortBeneficiaries,BinarySearchCard,OTPManager) are defined within the two source files — no external dependencies required.
- Java JDK 11 or above
- Any Java IDE (IntelliJ IDEA, Eclipse, VS Code with Java extension) or terminal
# Compile
javac RationDistributionSystem.java
# Run
java RationDistributionSystem# Compile (both files together, as RationUI.java depends on classes in RationDistributionSystem.java)
javac RationDistributionSystem.java RationUI.java
# Run
java RationUI💡 Place
goi_logo.jpgandpm_image.jpgin the same directory for the full header experience. The app falls back to placeholder icons if images are not found.
| Name | RCID | Category | Aadhar (last 4) | State |
|---|---|---|---|---|
| Amarjeet Singh | RC101 | BPL | 1234 | Punjab |
| Baldev Singh | RC102 | APL | 5678 | Punjab |
| Mamata Devi | RC103 | Antyodaya | 9012 | West Bengal |
| Sourav Roy | RC104 | BPL | 3456 | West Bengal |
| Priya Nair | RC105 | APL | 7890 | Kerala |
| Rahul Verma | RC106 | BPL | 2468 | Maharashtra |
| State | Rice | Wheat | Sugar | Oil |
|---|---|---|---|---|
| Punjab / Haryana | 5 | 10 | 2 | 1 |
| West Bengal | 10 | 3 | 2 | 1 |
| Kerala | 8 | 4 | 2 | 1 |
| Others | 6 | 6 | 2 | 1 |
Antyodaya families receive full allocation; BPL gets ⅔; APL gets ½.
This project was developed as part of a Data Structures & Algorithms course submission. It demonstrates the practical application of DSA concepts in a socially relevant domain — India's Public Distribution System.
Key concepts covered: Abstract classes, inheritance, static arrays, singly linked lists, FIFO queues, LIFO stacks, HashMap-based OTP management, bubble sort, insertion sort, binary search, and Java Swing GUI development.
This project is for academic and educational purposes.# Digital-Ration-Distribution-System