Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java** Inventory management tools are used in many different industries to keep

ID: 3738562 • Letter: J

Question

Java**

Inventory management tools are used in many different industries to keep track of products and their quantities.

In this project, you’ll create a simplified version of these tools.

The basic requirements are as follows:
•   Store product name, quantity, price, numeric ID and category.
•   Search for products by price, ID or name.
•   Quick overview of current inventory, including quantities of different products sorted by category.
•   Updating the database dynamically as a product is ‘checked out’ or removed from the system.

You can implement a graphical dashboard with charts and graphs indicating quantities of different products, a notification system to warn you about low levels of a particular product, include additional details such as manufacturer name, shipper details, etc. for added complexity.

Deliverables:
Your program should include the following modules:
a)   Add an inventory
b)   Edit/Update an inventory
c)   Delete a product
d)   Search for a product

Your application should be menu driven and there should be an option to exit the menu.

Explanation / Answer

import java.io.*;

import java.util.*;

class inventory

{

static ArrayList<String> name = new ArrayList<String>();

static ArrayList<Integer> quantity = new ArrayList<Integer>();

static ArrayList<Float> price = new ArrayList<Float>();

static ArrayList<Integer> id = new ArrayList<Integer>();

static ArrayList<String> category = new ArrayList<String>();

static Scanner in = new Scanner(System.in);

public static void main(String args[])

{

int input = 1;

System.out.println( "1. Add an inventory "

+"2. Edit/Update an inventory "

+"3. Delete a product "

+"4. Search a product ");

input = in.nextInt();

while(input!=0)

{

if(input==1)

{

System.out.println("Enter product name");

String n = in.next();

System.out.println("Enter product quantity");

int q = in.nextInt();

System.out.println("Enter product price");

float p = in.nextFloat();

System.out.println("Enter product id");

int i = in.nextInt();

System.out.println("Enter product category");

String c = in.next();

name.add(n);

quantity.add(q);

price.add(p);

id.add(i);

category.add(c);

}

if(input==2)

{

System.out.println("Search product to edit/update:");

int aid = search();

System.out.println("Enter product name");

String n = in.next();

System.out.println("Enter product quantity");

int q = in.nextInt();

System.out.println("Enter product price");

float p = in.nextFloat();

System.out.println("Enter product id");

int i = in.nextInt();

System.out.println("Enter product category");

String c = in.next();

name.add(aid, n);

quantity.add(aid, q);

price.add(aid, p);

id.add(aid, i);

category.add(aid, c);

name.remove(aid+1);

quantity.remove(aid+1);

price.remove(aid+1);

id.remove(aid+1);

category.remove(aid+1);

}

if(input==3)

{

System.out.println("Search Product to delete:");

int aid = search();

name.remove(aid);

quantity.remove(aid);

price.remove(aid);

id.remove(aid);

category.remove(aid);

}

if(input==4)

{

System.out.println("Search for a product:");

int aid = search();

System.out.println(name.get(aid));

System.out.println(quantity.get(aid));

System.out.println(price.get(aid));

System.out.println(id.get(aid));

System.out.println(category.get(aid));

}

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

printAll();

System.out.println( "1. Add an inventory "

+"2. Edit/Update an inventory "

+"3. Delete a product "

+"4. Search a product ");

input = in.nextInt();

}

}

public static void printAll()

{

System.out.println();

System.out.println(name);

System.out.println(quantity);

System.out.println(price);

System.out.println(id);

System.out.println(category);

System.out.println();

}

public static int search()

{

int rid=0;

System.out.println("1. Search by Price"

+" 2. Search by Id"

+" 3. Search by Name");

int input = in.nextInt();

if(input==1)

{

System.out.println("Enter Price");

int p = in.nextInt();

rid = searchPrice(p);

}

if(input==2)

{

System.out.println("Enter ID");

int i = in.nextInt();

rid = searchId(i);

}

if(input==3)

{

System.out.println("Enter Name");

String n = in.next();

rid = searchName(n);

}

return rid;

}

public static int searchPrice(int p)

{

for(int i=0; i< price.size(); i++)

{

if(price.get(i)==p)

{

return i;

}

}

return 0;

}

public static int searchId(int j)

{

for(int i=0; i< id.size(); i++)

{

if(id.get(i)==j)

{

return i;

}

}

return 0;

}

public static int searchName(String n)

{

for(int i=0; i< name.size(); i++)

{

if(name.get(i)==n)

{

return i;

}

}

return 0;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote