Question: Instructions: This exam consists of writing a Java program that incorporates concepts from collections, multi - threading, and database connectivity. You are required to use

Instructions:
This exam consists of writing a Java program that incorporates concepts from collections, multi-threading, and database connectivity.
You are required to use proper coding conventions and documentation.
Your program should be well-structured and demonstrate a clear understanding of the specified topics.
Marks will be awarded for correctness, efficiency, and clarity of the code.
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 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 (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.
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.
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.
Documentation and Code Quality_(25 marks):
4.1 Provide clear and concise comments throughout your code.
4.2 Follow proper coding conventions.
4.3 Ensure that your code is well-organized and easy to understand.
Instructions: This exam consists of writing a

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!