Question: Problem Statement: You are tasked with developing a multi - threaded Java program to manage a simple inventory system. The program should use a collection
Problem Statement:
You are tasked with developing a multithreaded Java program to manage a simple inventory system. The program should use a collection to store information about products and their quantities. Additionally, the program should implement multithreading to simulate concurrent transactions that involve updating the inventory. Finally, the program should establish a database connection to store and retrieve product information.
Requirements:
Collections marks:
Create a class named Product with attributes: productid productName, and quantityOnHand
Implement a collection eg ArrayList to store instances of the Product class.
Include methods to add a new product, update product quantity, and display the current inventory.
Multithreading marks:
Implement a class named Transaction that extends Thread
The Transaction class should have a method to simulate a purchase transaction, which involves updating the quantity of a random product in the inventory.
Create at least two instances of the Transaction class and run them concurrently to demonstrate multithreading.
Database Connectivity marks:
Establish a connection to a database you can use any database of your choice
Create a table to store product information, including productidproductName and quantityOnHand
Modify your program to use the database to store and retrieve product information.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
