Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OLAl12 Prejeet Due: Apria9, BACKGROUND: You have been hired by the ACME Supply Corporation to write a program to merge the inventory records of two

image text in transcribed
OLAl12 Prejeet Due: Apria9, BACKGROUND: You have been hired by the ACME Supply Corporation to write a program to merge the inventory records of two newly acquired stores. Although the inventory records of these two stores are very similar, they need a programmer to conflate the two sets of files, remove any erroneous inventory records, and standardize the inventory mcasures. TASK: Write a program to merge the two inventory files. The format of the inventory files s described below. Each unique item of inventory has been assigned a unique SKLI number. This SKU number is a self-checking number consisting of a base number and a modulus-10 check- digit suffix. Both files are sorted in SKU number order and the resulting merged file must be in proper order. Note that some inventory items have incorrect SKU numbers (ie, the self-check fails on these numbers), these items should not be placed in the merged file but should be sent to a reject file, as described below. Note also that if the identical SKU item appears in both input files, then the item amounts should be suitably combined and reported as one inventory record. COMPLICATIONS: The inventory measures are not uniformly consistent. Some inventory items have amounts expressed in imperial (aka english; aka U.S. Customary Measure) units The company needs all inventory measures to be in metric units. Thus if an inventory amount is expressed as an imperial amount, it must be converted to the equivalent metric amount in the merged file. The units of measure (expressed as character codes) that are within the files are Square Inches C Square Centimeters P Pounds (avoirdupois) kilos F Feet E Each INPUTIOUTPUT: The format for both the input and the output files is Positions 01-09 10-18 19-19 20-20 Description SKU Nunber (right-juseified) Unit of Measure (see above) NOTE: The amount should have one decimal place. Round as necessary. REJECT FILE: Any inventory records that have invalid inventory numbers are written to the reject file. Do nor convert units of measure nor attempt to merge them; these records should look exactly like they did on input. IMPLEMENTATION NOTES: For the completed version of this program, use as your source file name "consolidate-py". A starter skeleton program, is available as Be sure the first function in your source file is main0 and list the remaining functions in hierarchical order (as discussed when we reviewed hierarchy charts). De not use any global variables. The input files will be "storel.dat" and "store2 dat"; you will need to make a (virtual) copy of these files in your directory. To make these virtual copies (ie wholic links), use the commands S 1n - $PUB/storel.dat storel.dat S 1n - $PUB/store2.dat store2.dat The merged output file must be named merged.dat. The reject output file must be namod INSPIRATION: Pattern your conflation logic after the example SPLB conflatc.py we developed in class. REQUIRED: You are to electronically submit the source program, a source program listing and the execution results obtained from running your program. Once you have a working program, the following UNIX commands will do what is required s script ola112.1og cat n eonsolidate.py consolidate. py 1 storel dat store2.dat nerged.dat reject.dat s we merged.dat reject.dat cat -n merged.dat s cat -n reject.dat $ handin la112 consolidate.py ola112.log (Be sure to exir the script session before trying to handin the log!)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions