Skip to content

Ahmed-123-cpu/Java_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inventory & Supply Chain Management System

Java Undergraduate Group Project — 4th Semester


Project Overview

A fully functional Inventory & Supply Chain Management System built in Java, divided into 4 independent modules — one per group member.

Each module can be run standalone for individual testing, and all four modules are integrated together through MainSystem.java.


Group Members & Module Assignments

Member Module Files Owned Responsibility
Member 1 Module 1 Product.java, PerishableProduct.java, NonPerishableProduct.java, InventoryManager.java, Module1Main.java Product & Inventory Management
Member 2 Module 2 Supplier.java, SupplyOrder.java, SupplierManager.java, Module2Main.java Supplier & Supply Chain
Member 3 Module 3 SalesOrder.java, SalesManager.java, Module3Main.java Sales & Order Management
Member 4 Module 4 Admin.java, Searchable.java, Sortable.java, SearchSort.java, ReportGenerator.java, Module4Main.java Admin, Search, Sort & Reports
All Integration MainSystem.java Final integrated system

Java Concepts Used (Per Syllabus)

Concept Where Used
Abstract class Product.javaabstract class Product
Inheritance PerishableProduct extends Product, NonPerishableProduct extends Product
super keyword PerishableProduct constructor calls super(...)
Method overriding toString(), toFileString(), getProductType() overridden in subclasses
Interfaces Searchable.java, Sortable.java
Implementing interfaces SearchSort implements Searchable, Sortable
Abstract methods getProductType() in Product, all interface methods
final keyword Status constants in SupplyOrder, credentials in Admin
static import import static java.lang.Math.max in ReportGenerator
Arrays Product[], Supplier[], SupplyOrder[], SalesOrder[] throughout
File Handling loadFromFile(), saveToFile() in all Manager classes
Recursive method totalRevenueRecursive() in SalesManager
Bubble Sort sortByName(), sortByPrice(), sortByQuantity() in SearchSort
Linear Search searchByName(), searchByCategory(), findById()
Binary Search binarySearchById() in SearchSort
Loops & Conditionals Used throughout all files
Variables & Data Types int, double, String, boolean in all files
Pass by Value / Reference Primitives vs Object arrays passed to methods
Method Call Stack Demonstrated by recursive revenue calculation
Packages Default package (all files same folder)
Access Protection private fields + public getters/setters throughout
Keywords static, final, abstract, extends, implements, super, this
Constants MAX_PRODUCTS, LOW_STOCK_LIMIT, STATUS_PENDING, etc.
Control Statements switch-case in all Main files

File Structure

InventorySystem/
│
├── ── MODULE 1: Product & Inventory ──
│   ├── Product.java              (abstract base class)
│   ├── PerishableProduct.java    (extends Product)
│   ├── NonPerishableProduct.java (extends Product)
│   ├── InventoryManager.java     (manages products array + file I/O)
│   └── Module1Main.java          ← STANDALONE RUNNER for Member 1
│
├── ── MODULE 2: Supplier & Supply Chain ──
│   ├── Supplier.java             (supplier data class)
│   ├── SupplyOrder.java          (supply order with status constants)
│   ├── SupplierManager.java      (manages suppliers + orders + file I/O)
│   └── Module2Main.java          ← STANDALONE RUNNER for Member 2
│
├── ── MODULE 3: Sales & Orders ──
│   ├── SalesOrder.java           (sales order with item arrays)
│   ├── SalesManager.java         (manages sales + recursive revenue)
│   └── Module3Main.java          ← STANDALONE RUNNER for Member 3
│
├── ── MODULE 4: Admin, Search & Reports ──
│   ├── Admin.java                (login, logout, access control)
│   ├── Searchable.java           (interface)
│   ├── Sortable.java             (interface)
│   ├── SearchSort.java           (implements both interfaces)
│   ├── ReportGenerator.java      (full system report)
│   └── Module4Main.java          ← STANDALONE RUNNER for Member 4
│
├── ── INTEGRATION ──
│   └── MainSystem.java           ← FULL SYSTEM (all 4 modules together)
│
└── ── DATA FILES (auto-created on first save) ──
    ├── products.txt
    ├── suppliers.txt
    ├── supply_orders.txt
    ├── sales_orders.txt
    └── inventory_report.txt

How to Compile & Run

Compile ALL files (do this once):

javac *.java

Run the FULL integrated system:

java MainSystem

Default login: username = admin | password = admin123


Run each module STANDALONE (for individual testing):

Member 1 — Inventory:

java Module1Main

Member 2 — Suppliers:

java Module2Main

Member 3 — Sales:

java Module3Main

Member 4 — Admin/Search/Reports:

java Module4Main

Features

Module 1 — Product & Inventory

  • Add / Remove / Update products
  • Two product types: Perishable (with expiry date) and Non-Perishable
  • Automatic low stock alerts (quantity ≤ 5)
  • Save/load from products.txt
  • Static fallback data if file is missing

Module 2 — Supplier & Supply Chain

  • Add suppliers, place supply orders
  • Mark orders as Delivered (auto-updates inventory stock)
  • Cancel orders, view pending orders
  • Saves to suppliers.txt and supply_orders.txt

Module 3 — Sales & Orders

  • Create sales with multiple items per order
  • Stock validation before sale (won't allow overselling)
  • Auto-deducts sold quantity from inventory
  • Recursive total revenue calculation
  • Saves to sales_orders.txt

Module 4 — Admin, Search & Reports

  • Admin login with lockout after 3 failed attempts
  • Search products by Name / ID / Category
  • Binary Search (fast) + Linear Search (fallback)
  • Sort products by Name / Price / Quantity (Bubble Sort)
  • Full system report printed to screen
  • Save report to inventory_report.txt

Dynamic Input vs Static Fallback

Every ModuleXMain.java and MainSystem.java has this pattern:

static String readStr(String prompt, String fallback) {
    System.out.print(prompt);
    try {
        if (dynamicInput) {
            String in = sc.nextLine().trim();
            if (!in.isEmpty()) return in;
        }
    } catch (Exception e) {
        dynamicInput = false;   // disable dynamic input on failure
    }
    System.out.println("[fallback] " + fallback);
    return fallback;            // use hardcoded static fallback
}
  • If the user types input → uses that
  • If scanner fails (e.g. piped input, IDE issues) → uses the static fallback value
  • Great for demos where you can run without typing anything

Data File Formats

products.txt (one product per line):

P001,Rice 5kg,Grains,50,250.0,N/A,nonperishable
P003,Milk 1L,Dairy,30,60.0,2025-07-01,perishable

suppliers.txt:

S001,FreshFarm Supplies,9876543210,fresh@farm.com,4.5

supply_orders.txt:

SO001,S001,P003,Milk 1L,50,55.0,2025-06-10,PENDING

sales_orders.txt (one line per item in each order):

ORD001,Riya Sharma,2025-06-15,P001,Rice 5kg,2,250.0,COMPLETED
ORD001,Riya Sharma,2025-06-15,P002,Sugar 1kg,1,55.0,COMPLETED

Admin Credentials

Field Value
Username admin
Password admin123
Max Login Attempts 3

Tips for Each Member

  • Your module runs completely on its own — just java ModuleXMain
  • When running standalone, your module loads static fallback data automatically
  • All files in the same folder = same default Java package = can use each other's classes
  • Read the comments in your files — every concept is labeled (e.g. // Concept: Bubble Sort)
  • Don't modify other members' files — only add to your own
  • When the full system runs, data flows between modules automatically

Project built using Java SE — no external libraries required.

About

Java based inventory and supply chain management system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages