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 Products Display Out of Stock Products Sale a Product 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 <=P_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<=40. We also update P_Quantity = P_Quantity – quantity. Moreover, update S_Quantity = S_Quantity + Quantity. Exit: It will terminate the program.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 <=P_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<=40. We also update P_Quantity = P_Quantity – quantity.

Moreover, update S_Quantity = S_Quantity + Quantity.

Exit: It will terminate the program.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education