Skip to main content

Overview

The InventoryItem class represents an item in the inventory system. It tracks the item name, total availability, units sold, and profit information.

Constructors

Default Constructor

public InventoryItem()
Creates an empty InventoryItem instance with no initialized fields.

Full Parameterized Constructor

public InventoryItem(String itemName, int total_available, int sold, int profit)
Creates an InventoryItem with all fields explicitly specified.
itemName
String
The name of the inventory item
total_available
int
The total number of units available in inventory
sold
int
The number of units sold
profit
int
The profit value for this item

Auto-Calculate Profit Constructor

public InventoryItem(String itemName, int total_available, int sold)
Creates an InventoryItem with automatic profit calculation. The profit is calculated as (total_available - sold).
itemName
String
The name of the inventory item
total_available
int
The total number of units available in inventory
sold
int
The number of units sold

Fields

itemName
String
required
The name of the inventory item
total_available
int
required
The total number of units available in inventory
sold
int
required
The number of units sold
profit
int
required
The profit value for this item. Can be explicitly set or auto-calculated as (total_available - sold)

Methods

getItemName()

public String getItemName()
Returns the name of the inventory item. Returns: String - The item name

getTotal_available()

public int getTotal_available()
Returns the total number of units available in inventory. Returns: int - The total available units

getSold()

public int getSold()
Returns the number of units sold. Returns: int - The number of units sold

getProfit()

public int getProfit()
Returns the profit value for this item. Returns: int - The profit value

Source Code Location

~/workspace/source/app/src/main/java/project/avishkar/salesmanagement/InventoryItem.java

Build docs developers (and LLMs) love