I need to write an inventory system program using java...
The inventory control system should have
1. Login in to the system.
2. Adding new items.
3. Modifying data of selective item.
4. Deleting existing items.
5. Check the stock availability.
6. Real time stock management (ie. When purchase happen you have to increase the stock availability and if sales occurs you have to reduce the stock availability.)
hey guys.. i could really use some help.. im writing this in java.. i hv absolutely no clue what i should be doing.. cuz out lecturer is rubish..
but..
i did some reading and i tried something out i dunno if you guys could help...
i made two classes Inventory and Item
i will past the code i have written...
what i really want to know how 2 do tho is number 6. which is
" real time management" ( no clue what this is or where to start)
this is as far as reading ( as a complete newbie) got me..
please help me out guys...
most important is number 6 the real time management ( which i have not written cuz i dpont know how)\
thank u
here is the code
Inventory src code :
public class inventory {
private static Item[] inventory;
private static Scanner sc;
private static int noOfItems;
/**
* @param args
*/
public static void main(String[] args) {
noOfItems=0;
sc=new Scanner(System.in);
// TODO Auto-generated method stub
inventory=new item[10];
run();
}
public static int displayMenu()
{
System.out.println("1.Add Item");
System.out.println("2.Find Item");
System.out.println("3.Delete Item");
System.out.println("4.Count Item");
System.out.println("5.Exit");
System.out.println("Please enter your choice:");
int i=sc.nextInt();
return i;
}
public static void run()
{
while(true)
{
int i=displayMenu();
switch(i)
{
case 1:addItem();
break;
case 2:findItem();
break;
case 4:countItem();
break;
case 5:return;
defaultystem.out.println("Invalid choice");
}
}
}
public static void addItem()
{
System.out.print("Enter Item namme:");
String item_name=sc.next();
System.out.print("Enter barcode:");
String barcode=sc.next();
System.out.print("Enter price:");
double price=sc.nextDouble();
Item b=new Item(item_name,barcode,price);
if(noOfItems==inventory.length)
System.out.println("Array is full");
else
{
inventory[noOfItems++]=b;
System.out.println("Item added successfully");
}
}
public static void findItem()
{
System.out.print("Enter item name:");
String item_name=sc.next();
for(int i=0; i<noOfItems; i++)
{
if(item_name.equalsIgnoreCase(inventory[i].getItem_name()))
{
System.out.println("Item found:");
System.out.print(Inventory[i]);
return;
}
}
}
public static void countItems()
{
System.out.println("Num of items:"+noOfItems);
for(int i=0; i< noOfItems; i++)
System.out.println(inventory[i]);
}
}
ITEM src codehere
public class item {
private String item_name;
private String barcode;
private double price;
//To initialise the state of the object
public void Item(String item_name,String barcode,double price)
{
this.item_name=item_name;
this.barcode=barcode;
this.price=price;
}
//Reader methods i.e behavior methods
public String getItem_name()
{
return item_name;
}
public String getBarcode()
{
return barcode;
}
public double getPrice()
{
return price;
}
//Writer methods or setter methods
public void setTitle(String item_name)
{
this.item_name=item_name;
}
public void setPrice(double price)
{
if(price < 0)
System.out.println("Price cannot be negative");
else
this.price=price;
}
public void setBarcode(String barcode)
{
this.barcode=barcode;
}
public String toString()
{
return "Item name:"+item_name+",Barcode:"+barcode+",Price:"+price;
}
}