Inventory Workflow Example
This program models inventory management workflow.
Problem Statement
Write a Java program to model Inventory and Workflow classes.
Source Code
| 1 | class Inventory { |
| 2 | String item; int stock; |
| 3 | Inventory(String i,int s){ item=i; stock=s; } |
| 4 | void updateStock(int qty){ stock+=qty; } |
| 5 | } |
| 6 | class Workflow { |
| 7 | void process(Inventory inv,int qty){ |
| 8 | inv.updateStock(qty); |
| 9 | System.out.println("Updated stock: "+inv.item+", Qty: "+inv.stock); |
| 10 | } |
| 11 | } |
| 12 | public class InventoryWorkflow { |
| 13 | public static void main(String[] args) { |
| 14 | System.out.println("Eduinq Inventory Workflow"); |
| 15 | Inventory inv=new Inventory("Mobile",10); |
| 16 | Workflow w=new Workflow(); |
| 17 | w.process(inv,5); |
| 18 | } |
| 19 | } |
Program Output
Eduinq Inventory Workflow Updated stock: Mobile, Qty: 15
Explanation
Inventory models item and stock. - Workflow updates stock. - This demonstrates enterprise inventory management workflow. Conclusion: Shows inventory management workflow.