0% found this document useful (0 votes)
18 views10 pages

Arshdeep

The document outlines the development of an Inventory Tracking System using Object-Oriented Java concepts, focusing on real-time inventory management. It includes a UML diagram, code implementation for classes such as Item, Administrator, and Customer, and testing use cases for adding and purchasing items. Challenges faced during development included ensuring effective inventory control, avoiding functional redundancy, and creating a user-friendly interface.

Uploaded by

eontrack.yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views10 pages

Arshdeep

The document outlines the development of an Inventory Tracking System using Object-Oriented Java concepts, focusing on real-time inventory management. It includes a UML diagram, code implementation for classes such as Item, Administrator, and Customer, and testing use cases for adding and purchasing items. Challenges faced during development included ensuring effective inventory control, avoiding functional redundancy, and creating a user-friendly interface.

Uploaded by

eontrack.yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Inventory Tracking System

Course Code: IN2343-G3


Student Name: Arshdeep Singh
Student ID: 202302145
1. Problem Description

Businesses must have a robust system in place to manage inventory, track stock levels, and
guarantee flawless operations. Aiming at real-time tracking of inventory levels, this project
builds an Inventory Tracking System using Object-Oriented Java concepts.

• Object additions and deletions by administrator.


• Simplified systems of replenishment and item sales.

2. UML Diagram

2.1. UML

2.2. Design Description

Architectural concepts of Object- Oriented Programming are embodied in this Inventory


Tracking System:
Important qualities (name, price, quantity) in item are private, under controlled access.
Item objects let Customer and Administrator classes manage inventory control and purchase.
UpdateStock() and purchaseItem() allows one to reach dynamic behavior.
Every class covers specific duties in modular architecture:
a. Item: Indicates particular items in stock.
Managers stock addition and removal under supervision.
a. Client: Oversees item acquisitions.

3. Code Implementation

3.1. Java Code

import java.util.ArrayList;

import java.util.List;

// Item Class

class Item {

private String name;

private double price;

private int quantity;

public Item(String name, double price, int quantity) {

this.name = name;

this.price = price;

this.quantity = quantity;

public String getDetails() {


return "Item: " + name + ", Price: $" + price + ", Stock: " + quantity;

public void updateStock(int change) {

this.quantity += change;

public boolean isAvailable(int requestedQuantity) {

return this.quantity >= requestedQuantity;

public void reduceStock(int quantity) {

if (this.quantity >= quantity) {

this.quantity -= quantity;

} else {

System.out.println("Insufficient stock for " + name);

// Administrator Class

class Administrator {

public void viewInventory(List<Item> items) {


System.out.println("Current Inventory:");

for (Item item : items) {

System.out.println(item.getDetails());

public void addItem(Item item, List<Item> items) {

items.add(item);

System.out.println(item.getDetails() + " added to inventory.");

public void removeItem(Item item, List<Item> items) {

if (items.remove(item)) {

System.out.println(item.getDetails() + " removed from inventory.");

} else {

System.out.println("Item not found in inventory.");

// Customer Class

class Customer {

private String name;


public Customer(String name) {

this.name = name;

public void purchaseItem(Item item, int quantity) {

if (item.isAvailable(quantity)) {

item.reduceStock(quantity);

System.out.println(name + " purchased " + quantity + " units of " + item.getDetails());

} else {

System.out.println("Purchase failed: Insufficient stock for " + item.getDetails());

// Main Class

public class InventoryTrackingSystem {

public static void main(String[] args) {

// Initialize inventory and administrator

List<Item> inventory = new ArrayList<>();

Administrator admin = new Administrator();

// Add items to inventory


Item item1 = new Item("Laptop", 1200.50, 10);

Item item2 = new Item("Smartphone", 800.75, 5);

admin.addItem(item1, inventory);

admin.addItem(item2, inventory);

// View inventory

admin.viewInventory(inventory);

// Customer purchase

Customer customer = new Customer("John");

customer.purchaseItem(item1, 2); // John purchases 2 laptops

customer.purchaseItem(item2, 6); // Attempt to purchase more than stock

// View inventory after purchase

admin.viewInventory(inventory);

3.2. Code Explanation

1. Item Class:

o Represents individual inventory items.

o Methods like updateStock(), isAvailable(), and reduceStock() manage stock


levels.
2. Administrator Class:

o Handles the addition, removal, and viewing of items in the inventory.

3. Customer Class:

o Facilitates item purchases and ensures sufficient stock availability.

4. Main Class:

o Demonstrates the system's functionality by simulating administrator and customer


actions.

4. Testing Use Cases

Use Case 1: Adding and Viewing Items

1. Input: Administrator adds "Laptop" and "Smartphone" to the inventory.

2. Output: Inventory displays the details of the two added items.

Use Case 2: Purchasing an Item

1. Input: Customer "John" attempts to purchase 2 laptops.

2. Output: Inventory stock for laptops decreases by 2, and the purchase is confirmed. If
requested stock exceeds availability, an error message is displayed.
5. Reflection on Challenges

Establishing Effective Inventory Control


One of the main challenges became ensuring the system could handle edge conditions, such
insufficient supplies during procurement efforts. Early installations lacked validation, hence
erroneous stock updates upon consumer requests for limited supplies.
To manage this, validation logic was included to the functions available() and reduce Stock().
These checks help to avoid overbuying and assure consistent stock levels even in edge
circumstances.

Staying away from functional redundancy


Another challenge was avoiding duplication of capability across the Administrator and Customer
classes, especially given both classes interact with the same inventory. At first, repeated codes
for stock-related operations carried the risk of complicating the maintenance and expansion of
the system.
The item class combined basic operations including stock reductions, availability checks, and
stock updates. This modular architecture minimized duplicity and streamlined code
administration.

Creating a friendly interface


Especially for activities like inventory control and purchasing control, making sure the system
was user-friendly for customers generated challenges. Early iterations of the interface were
confusing, which would have misled consumers all through interactions.
These days, the focus switched to providing useful console outputs and employing informative
method names. For example, whilst terminal messages were enhanced to give users immediate
feedback on their operations, tools like viewInventory() and purchaseItem() were aimed to make
their operation explicit.

You might also like