Write an inventory program for a small camera and video store. You must read in the current inventory records from a file, and store the inventory information given in an array of structs. You may assume that it has anywhere from 1 up to 100 items in stock at this time. The first part of the data file, the inventory section, will contain a series of lines, one line per product, with the following information on each: (1) item number (a $-digit integer), (2) number currently in stock (an integer in the range 0 thru 99), (3) unit price (real), (4) item name (a string of up to 50 characters). This data is not sorted. Print this initial inventory information in a table. After you read in the echoprint the inventory, sort the data structure in ascending order by item number. Then print another table, showing the current inventory in the same format as before, but in sorted form.
Next you are ready for the inventory updating portion of the program. The second part of the data file, the update section, contains records of recent orders processed which must be used to update the inventory records. Each line in this part of the data file contains one transaction, giving (1) the order number (3 letters followed by 4 digits), (2) item number (same as above), (3) transaction code (‘S’=sold, ‘R’=returned), and (4) number of items sold or returned (an integer). The item number should correspond to an item number read in from the inventory ??" if so, the transaction is recorded by updating the data structure storing the inventory data. If the transaction code is ‘R’, the number of items returned is added to the number in stock. If the code is ‘S’, the number sold is subtracted from the number in stock. If more items are sold than are in stock, print a message to the effect, and printa message giving the number which must be back-ordered (the difference between the number ordered and the number in stock). Then set the number currently in stock to zero. Note that for each item in the inventory, there may be zero, one, or multiple transactions.
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).
Do not hard-code the file name into your program. The file name is to be read in as interactive imput. If the file does not open, ask the user to re-enter the file name. Keep asking them to re-enter a file name until the file opens correctly. You may copy this code. You may assume that a file name is no longer than 25 characters and contains no blanks.
A valid data file contains:
First part of data file (inventory): each line contains (one line per item)
*Starting in column 1 : item number*
*6 : number in stock*
*9 : unit price*
*17: item name*
Second part of data file (updates): each line contains (unknown number of lines)
*Starting in column 1 : order number*
*9 : item number*
*14: transaction code*
*16: number sold or returned*
You may assume that every data line in the inventory section of the file is accurate and does not need to be checked. However, certain errors may occur in the update section. The transaction cannot be processed, and error messages must be printed in (1) the item number specified in a transaction line was not in the original inventory data, and/or (2) the transaction code is not ‘S’ or ‘R’ (note only capitals are valid), and/or (3) the number of items sold or returned is negative. Print an error message which tells exactly what happened. For example, if both the transaction code is invalid and the number of items is negative, you would print 2 error messages, one stating that the transaction code was invalid, and one stating that the number of items given was invalid (less than zero).
Required output includes:
1. table of echoprinted inventory data, in the order read in
2. table of echoprinted inventory data, sorted
3. as each transaction line is processed, echoprint the data from the transaction line, then print a message describing what action was taken, and any error messages if needed; this output section would best be displayed in tabular form also
4. table of inventory, after all update transactions are processed
Note that printed tables of inventory data must show all 4 data values for all items at the store.
**Use of Required Data Structures and Algorithms**
You must use an array of structs to store and process the inventory data. Each inventory item must have it’s data represented in one struct in the array.
You must use either the linear or the binary search to locate inventory entries.
You must use the selection sort as discussed in lecture to perform the sorting operation.