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 multi-threaded 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 multi-threading to simulate concurrent transactions that involve updating the inventory. Finally, the program should establish a database connection to store and retrieve product information.
Requirements:
1. Collections (20 marks):
1.1. Create a class named Product with attributes: productid, productName, and quantityOnHand.
1.2. Implement a collection (e.g., ArrayList) to store instances of the Product class.
1.3. Include methods to add a new product, update product quantity, and display the current inventory.
2. Multi-threading (30 marks):
2.1. Implement a class named Transaction that extends Thread.
2.2. The Transaction class should have a method to simulate a purchase transaction, which involves updating the quantity of a random product in the inventory.
2.3. Create at least two instances of the Transaction class and run them concurrently to demonstrate multi-threading.
3. Database Connectivity (25 marks):
3.1. Establish a connection to a database (you can use any database of your choice).
3.2. Create a table to store product information, including productid,productName, and quantityOnHand.
3.3. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!