C Program: Write a C Program that allows the following Manu list. Product (P_Id, P_Name, P_Quantity, Unit_Price, S_Quantity) Add New Product Add Existing Product Search Product by PID Display All...



C Program:



Write a C Program that allows the following Manu list.


Product (P_Id, P_Name, P_Quantity, Unit_Price, S_Quantity)



  1. Add New Product

  2. Add Existing Product

  3. Search Product by PID

  4. Display All Products

  5. Display Out of Stock Products

  6. Sale a Product

  7. Exit




Hint:
Use a loop to run Menu repeatedly.




The Program should have a limit of at least 100 records.
Create the above 7 functions. The functionality of the functions is as under:





Add New Product:
This function will add a new product where
S_Quantity
will be initially 0. It also, check first if the product is already existing and show the error message.





Add Existing Product:
This function will add the existing product by using
P_Id. Only update the
P_Quantity
attribute. It will add the existing
P_Quantity + New P_Quantity.


For example, 15 is already stored as
P_Quantity
and the new given
P_Quantity is 25. The update
P_Quantity
will be
15+25 = 40.





Search Product by PID:
This function will Search the Item by
P_Id
and display the product data on screen also check for valid
P_ID. Display All Products: This function will Display all products data.




Display Out of
Stock Products:
This function will display the data of those products whose
P_Quantity
is zero.





Sale of Product:
This function will use for sale of the products. It enters the product ID as input. It checks first for valid
P_Id. If the entered
P_Id
is correct, it will ask for quantity, which a customer want to buy.



Then it checks for if the required quantity is available for this product (quantity <>). If available, it subtracts the
P_Quantity
by quantity and add the quantity into
S_Quantity.


For example, user ask for a quantity 15 and we already have a
P_Quantity = 40
so we can sale this product as the
15<>. We also update
P_Quantity = P_Quantity โ€“ quantity.


Moreover, update
S_Quantity = S_Quantity + Quantity.



Exit:
It will terminate the program.


Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here