Attached are the data files items.txt and prices.txt. The items file contains an item code, description, and the quantity on hand. The prices file contains the item code and the associated price. All items are in the price file but only the items we have in stock are in the inventory file. Each field of both files is on a separate record.
Read the items file and find the matching record from the prices file. When a matching record is found, the following report line should be written to an output CSV (comma separated variable) file.
Items without a matching price record should be written to the output with a price and value of zero.
Read all of the records from the prices file into a two-dimensional table, and then read each item file "record" one at a time and match them (allow for the possibility that no match exists) to the prices table. Assume the files are both in ascending sequential order ( small to large ).
A two-dimensional array should be used to hold the prices file contents. Each row of the array will hold a prices record, column one will be the item number, and column 2 will be the price for that item. Don't limit the size of the prices array. There may be more than five records in the files.
The item file should be read and matched, one item at a time, i.e. not loaded into a table.
Procedures needed to load the price file into a table, read a single item record, creating an output record.
One file,the prices file should be read and stored in an array before trying to redirect and read the items file.
With each field in a separate record, a get must be issued for each field, and each get preceded by an End-Of_Input test must be made.
A named constant COMMA will help format your output record.
Redirect your output to a file, called report.csv, separate your output fields with a comma, and output an initial record containing code, description, price, on-hand, total value. The output file can then be opened with Excel. Use the redirect_input(yes) and place these files in the same folder as your rap file. I will test your flowchart using these two files to grade them, so you need to verify you can successfully run with them before submitting your flowchart. Hint, both files do not contain the appropriate number of records at the end.
Sub charts will NOT be accepted. Only use procedures with parameters, in or out only.
Code Description Price On-hand Value 1 Java Made $10 5 $50 3 Head First Ajax $3.50 1 $3.50 5 HTML5 Cookbook $0 0 $0 6 Test Driven Development $0 2 $0 7 unknown $0 -1 $0 End of Report
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.