An engineer keeps an inventory of car parts, but on paper. The usual operations on his ‘inventory database’ include adding new parts, updating levels of current stock and producing different reports based on the current stock levels. As the inventory is getting larger, this manual system is becoming difficult to manage. The engineer decided to develop a computerized system to help him manage the inventory. As he is not expert in database management systems, he decided to develop his own application, based on the C++ knowledge he had during his early university education. The inventory data are printed as in the following table:
make model partNo price quantity partName
Pajero NA1H25 1 3.65 11 BLADE W/S WIPER
*there is almost a thousand of these but I put it just to know the data-type:
Data must be read from the inventory file and stored in one-dimensional arrays of correct data type. Further data processing is performed on these arrays.
Requirements
You are required to help this engineer by developing the Inventory Control System. Your system should perform the following operations:
Add a new item. Write a function called addItem() that asks the user to input data of a new part and then add the data to the parts file.
Update stock level. Write a function called updateItem() that takes as parameter the partNo and the quantity to be added/removed. Check that enough items are there if the operation is a remove operation.
Remove an item. You cannot remove an array element. However, let us use a negative partNo to indicate a removed item. When saving the arrays to the file, only save items with positive partNo.
List the current inventory in a tabular format (begin with the partNo followed by the PartName). In the last column of this list show the total price of each item (i.e. price*quantity).
Produce lists of the following:
o All items whose quantity field < 5.
o All items whose price is greater than a value provided by the user.
o All items whose price is greater than the average item price.
o Stock statistics such as: the current value of the stock (sum of price*quantity), the average price, the most expensive item, the least expensive item, the least stocked item … etc.