Question: Objective: Build a C # program that manages a list of products in an inventory. The program should allow users to add, search, and
Objective: Build a C# program that manages a list of products in an inventory. The program should allow users to add, search, and display products, as well as saveload inventory data to and from a file.
Project Requirements
Product Class: Create a class with the following properties:
Product ID string: A unique identifier for the product.
Name string: The product name.
Price decimal: The product price.
Quantity in Stock int: The number of items in stock.
Main Program Functionalities:
Add Product: Allow the user to add a new product to the inventory. Check for duplicate product IDs and handle them gracefully with an exception.
Search Product: Let the user search for a product by ID or name. If the product is not found, handle it with an exception and display a userfriendly message.
Update Stock: Provide an option to update the stock of a specific product.
Display Inventory: Display a list of all products in the inventory with their details ID name, price, quantity
File Handling:
Save Inventory: Save the current inventory to a file eg inventory.txt Each line in the file should contain a product's details in a structured format eg CSV
Load Inventory: Load inventory data from a file. Handle exceptions if the file is not found or if there's a formatting error in the data.
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
