Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write code in C. Write a program that reads a comma-delimited file of items information, items.txt, including item number, item name and item quantity. First,

Write code in C.

Write a program that reads a comma-delimited file of items information, items.txt, including item number, item name and item quantity. First, stores all items in a linked list where the list satisfies the following conditions: 1- Each node contains item number, item name and total quantity. 2- The list is sorted in increasing order of item number. 3- Each item has only one node in the list. 4- The quantity of a node shows the total quantity of the item in the file. So, if there are more than one row with the same item number in the file, you should store the sum of their quantities in the node corresponding to that item. Then print the list in the file, output.txt, with the following format at each row: Item number; item name; total quantity Note: To test your program, you can compare your output with myout.txt file. (Do not hard code any information except file names and formats.)

This is item.txt

10061,High Speed Automatic Electric Letter Opener,5 10047,Avery 510,4 10055,Bell Sonecor JB700 Caller ID,1 10036,Bevis Steel Folding Chairs,4 10030,Col-Erase? Pencils with Erasers,6 10074,3M Office Air Cleaner,4 10003,Cardinal Slant-D? Ring Binder Heavy Gauge Vinyl,5 10100,600 Series Flip,6 10070,Bush Westfield Collection Bookcases Dark Cherry Finish Fully Assembled,7 10027,SANFORD Liquid Accent? Tank-Style Highlighters,1 10024,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,7 10030,Col-Erase? Pencils with Erasers,5 10039,IBM Multi-Purpose Copy Paper 8 1/2 x 11 Case,10 10098,Prismacolor Color Pencil Set,9 10072,SAFCO Arco Folding Chair,2 10002,1.7 Cubic Foot Compact Cube Office Refrigerators,7 10012,Advantus Map Pennant Flags and Round Head Tacks,4 10042,Computer Printout Paper with Letter-Trim Perforations,9 10059,Accessory4,1 10002,1.7 Cubic Foot Compact Cube Office Refrigerators,9 10081,Luxo Professional Combination Clamp-On Lamps,1 10086,Hon 4070 Series Pagoda? Round Back Stacking Chairs,6 10052,Unpadded Memo Slips,10 10011,Xerox 1980,3 10030,Col-Erase? Pencils with Erasers,7 10071,12-1/2 Diameter Round Wall Clock,6 10088,Xerox 1891,4 10100,600 Series Flip,6 10067,Crate-A-Files?,6 10068,Angle-D Binders with Locking Rings Label Holders,4 10093,Staples Wirebound Steno Books 6 x 9 12/Pack,4 10045,Hoover Portapower? Portable Vacuum,2 10081,Luxo Professional Combination Clamp-On Lamps,1 10052,Unpadded Memo Slips,8 10066,Telephone Message Books with Fax/Mobile Section 5 1/2 x 3 3/16,4 10093,Staples Wirebound Steno Books 6 x 9 12/Pack,4 10057,APC 7 Outlet Network SurgeArrest Surge Protector,1 10094,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,2 10074,3M Office Air Cleaner,5 10078,Carina Double Wide Media Storage Towers in Natural & Black,5 10074,3M Office Air Cleaner,5 10030,Col-Erase? Pencils with Erasers,7 10025,Maxell 3.5 DS/HD IBM-Formatted Diskettes 10/Pack,9 10054,Eldon Expressions? Desk Accessory Wood Pencil Holder Oak,8 10029,Tenex Personal Project File with Scoop Front Design Black,6 10005,Holmes HEPA Air Purifier,1 10064,Boston Electric Pencil Sharpener Model 1818 Charcoal Black,3 10030,Col-Erase? Pencils with Erasers,6 10011,Xerox 1980,3 10046,Timeport L7089,3 10083,Revere Boxed Rubber Bands by Revere,9 10036,Bevis Steel Folding Chairs,6 10093,Staples Wirebound Steno Books 6 x 9 12/Pack,1 10057,APC 7 Outlet Network SurgeArrest Surge Protector,1 10018,Hon 4-Shelf Metal Bookcases,3 10083,Revere Boxed Rubber Bands by Revere,9 10064,Boston Electric Pencil Sharpener Model 1818 Charcoal Black,3 10065,Hammermill CopyPlus Copy Paper (20Lb. and 84 Bright),6 10057,APC 7 Outlet Network SurgeArrest Surge Protector,7 10092,Microsoft Natural Multimedia Keyboard,10 10047,Avery 510,2 10088,Xerox 1891,3 10092,Microsoft Natural Multimedia Keyboard,6 10091,Lifetime Advantage? Folding Chairs 4/Carton,7 10042,Computer Printout Paper with Letter-Trim Perforations,5 10045,Hoover Portapower? Portable Vacuum,6 10084,Acco Smartsocket? Table Surge Protector 6 Color-Coded Adapter Outlets,4 10018,Hon 4-Shelf Metal Bookcases,3 10047,Avery 510,6 10074,3M Office Air Cleaner,4 10045,Hoover Portapower? Portable Vacuum,2 10036,Bevis Steel Folding Chairs,4 10055,Bell Sonecor JB700 Caller ID,6 10033,Self-Adhesive Address Labels for Typewriters by Universal,5 10089,Avery 506,9 10099,Xerox Blank Computer Paper,8 10062,Xerox 1966,8 10003,Cardinal Slant-D? Ring Binder Heavy Gauge Vinyl,3 10028,Canon PC940 Copier,1 10043,6160,7 10006,G.E. Longer-Life Indoor Recessed Floodlight Bulbs,9 10002,1.7 Cubic Foot Compact Cube Office Refrigerators,7 10085,Tennsco Snap-Together Open Shelving Units Starter Sets and Add-On Units,6 10082,Xerox 217,9 10076,Xerox 1936,7 10072,SAFCO Arco Folding Chair,2 10005,Holmes HEPA Air Purifier,1 10022,Avery 52,6 10085,Tennsco Snap-Together Open Shelving Units Starter Sets and Add-On Units,6 10045,Hoover Portapower? Portable Vacuum,7 10091,Lifetime Advantage? Folding Chairs 4/Carton,9 10066,Telephone Message Books with Fax/Mobile Section 5 1/2 x 3 3/16,7 10086,Hon 4070 Series Pagoda? Round Back Stacking Chairs,4 10046,Timeport L7089,2 10065,Hammermill CopyPlus Copy Paper (20Lb. and 84 Bright),7 10081,Luxo Professional Combination Clamp-On Lamps,10 10028,Canon PC940 Copier,7 10055,Bell Sonecor JB700 Caller ID,1 10092,Microsoft Natural Multimedia Keyboard,6 10094,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,2 10049,LX 788,8 10074,3M Office Air Cleaner,1 10027,SANFORD Liquid Accent? Tank-Style Highlighters,1 10042,Computer Printout Paper with Letter-Trim Perforations,9 10045,Hoover Portapower? Portable Vacuum,6 10045,Hoover Portapower? Portable Vacuum,6 10045,Hoover Portapower? Portable Vacuum,7 10001,Eldon Base for stackable storage shelf platinum,4 10047,Avery 510,6 10064,Boston Electric Pencil Sharpener Model 1818 Charcoal Black,3 10020,g520,6 10071,12-1/2 Diameter Round Wall Clock,3 10096,Linden? 12 Wall Clock With Oak Frame,2 10043,6160,7 10074,3M Office Air Cleaner,1 10010,Xerox 198,10 10091,Lifetime Advantage? Folding Chairs 4/Carton,7 10079,Staples? General Use 3-Ring Binders,4 10008,SAFCO Mobile Desk Side File Wire Frame,7 10054,Eldon Expressions? Desk Accessory Wood Pencil Holder Oak,5 10081,Luxo Professional Combination Clamp-On Lamps,1 10030,Col-Erase? Pencils with Erasers,6 10012,Advantus Map Pennant Flags and Round Head Tacks,4 10074,3M Office Air Cleaner,4 10033,Self-Adhesive Address Labels for Typewriters by Universal,5 10009,SAFCO Commercial Wire Shelving Black,3 10048,Xerox 1881,5 10005,Holmes HEPA Air Purifier,8 10022,Avery 52,5 10098,Prismacolor Color Pencil Set,1 10063,Xerox 213,6 10039,IBM Multi-Purpose Copy Paper 8 1/2 x 11 Case,3 10097,Newell 326,3 10013,Holmes HEPA Air Purifier,10 10081,Luxo Professional Combination Clamp-On Lamps,10 10094,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,2 10034,Accessory37,4 10045,Hoover Portapower? Portable Vacuum,6 10085,Tennsco Snap-Together Open Shelving Units Starter Sets and Add-On Units,9 10035,Fuji 5.2GB DVD-RAM,8 10033,Self-Adhesive Address Labels for Typewriters by Universal,5 10090,Bush Heritage Pine Collection 5-Shelf Bookcase Albany Pine Finish *Special Order,6 10051,Memorex 4.7GB DVD-RAM 3/Pack,8 10088,Xerox 1891,3 10067,Crate-A-Files?,6 10008,SAFCO Mobile Desk Side File Wire Frame,7 10060,Personal Creations? Ink Jet Cards and Labels,2 10070,Bush Westfield Collection Bookcases Dark Cherry Finish Fully Assembled,7 10058,Deflect-o RollaMat Studded Beveled Mat for Medium Pile Carpeting,10 10051,Memorex 4.7GB DVD-RAM 3/Pack,9 10008,SAFCO Mobile Desk Side File Wire Frame,10 10094,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,2 10085,Tennsco Snap-Together Open Shelving Units Starter Sets and Add-On Units,8 10008,SAFCO Mobile Desk Side File Wire Frame,3 10073,#10 White Business Envelopes,4 1/8 x 9 1/2,6 10100,600 Series Flip,9 10058,Deflect-o RollaMat Studded Beveled Mat for Medium Pile Carpeting,10 10016,Ultra Commercial Grade Dual Valve Door Closer,5 10045,Hoover Portapower? Portable Vacuum,7 10036,Bevis Steel Folding Chairs,6 10096,Linden? 12 Wall Clock With Oak Frame,5 10060,Personal Creations? Ink Jet Cards and Labels,2 10096,Linden? 12 Wall Clock With Oak Frame,2 10056,Avery Arch Ring Binders,5 10096,Linden? 12 Wall Clock With Oak Frame,7 10014,DS/HD IBM Formatted Diskettes 200/Pack - Staples,6 10095,Bevis Boat-Shaped Conference Table,8 10013,Holmes HEPA Air Purifier,10 10006,G.E. Longer-Life Indoor Recessed Floodlight Bulbs,9 10066,Telephone Message Books with Fax/Mobile Section 5 1/2 x 3 3/16,7 10078,Carina Double Wide Media Storage Towers in Natural & Black,5 10060,Personal Creations? Ink Jet Cards and Labels,2 10051,Memorex 4.7GB DVD-RAM 3/Pack,9 10045,Hoover Portapower? Portable Vacuum,2 10046,Timeport L7089,3 10002,1.7 Cubic Foot Compact Cube Office Refrigerators,7 10047,Avery 510,6 10060,Personal Creations? Ink Jet Cards and Labels,2 10096,Linden? 12 Wall Clock With Oak Frame,2 10047,Avery 510,2 10100,600 Series Flip,9 10024,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,3 10013,Holmes HEPA Air Purifier,10 10051,Memorex 4.7GB DVD-RAM 3/Pack,8 10054,Eldon Expressions? Desk Accessory Wood Pencil Holder Oak,8 10024,GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11,3 10071,12-1/2 Diameter Round Wall Clock,3 10070,Bush Westfield Collection Bookcases Dark Cherry Finish Fully Assembled,7 10096,Linden? 12 Wall Clock With Oak Frame,5 10093,Staples Wirebound Steno Books 6 x 9 12/Pack,10 10041,XtraLife? ClearVue? Slant-D? Ring Binders by Cardinal,10 10065,Hammermill CopyPlus Copy Paper (20Lb. and 84 Bright),7 10035,Fuji 5.2GB DVD-RAM,8 10081,Luxo Professional Combination Clamp-On Lamps,10 10095,Bevis Boat-Shaped Conference Table,8 10005,Holmes HEPA Air Purifier,9 10083,Revere Boxed Rubber Bands by Revere,4 10015,Wilson Jones 1 Hanging DublLock? Ring Binders,6 10081,Luxo Professional Combination Clamp-On Lamps,10 10069,80 Minute CD-R Spindle 100/Pack - Staples,8 10015,Wilson Jones 1 Hanging DublLock? Ring Binders,3 10071,12-1/2 Diameter Round Wall Clock,6 

This is What it suppose to look like in my output.txt, the myout.txt.

10001;Eldon Base for stackable storage shelf platinum;4 10002;1.7 Cubic Foot Compact Cube Office Refrigerators;30 10003;Cardinal Slant-D? Ring Binder Heavy Gauge Vinyl;8 10005;Holmes HEPA Air Purifier;19 10006;G.E. Longer-Life Indoor Recessed Floodlight Bulbs;18 10008;SAFCO Mobile Desk Side File Wire Frame;27 10009;SAFCO Commercial Wire Shelving Black;3 10010;Xerox 198;10 10011;Xerox 1980;6 10012;Advantus Map Pennant Flags and Round Head Tacks;8 10013;Holmes HEPA Air Purifier;30 10014;DS/HD IBM Formatted Diskettes 200/Pack - Staples;6 10015;Wilson Jones 1 Hanging DublLock? Ring Binders;9 10016;Ultra Commercial Grade Dual Valve Door Closer;5 10018;Hon 4-Shelf Metal Bookcases;6 10020;g520;6 10022;Avery 52;11 10024;GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11;13 10025;Maxell 3.5 DS/HD IBM-Formatted Diskettes 10/Pack;9 10027;SANFORD Liquid Accent? Tank-Style Highlighters;2 10028;Canon PC940 Copier;8 10029;Tenex Personal Project File with Scoop Front Design Black;6 10030;Col-Erase? Pencils with Erasers;37 10033;Self-Adhesive Address Labels for Typewriters by Universal;15 10034;Accessory37;4 10035;Fuji 5.2GB DVD-RAM;16 10036;Bevis Steel Folding Chairs;20 10039;IBM Multi-Purpose Copy Paper 8 1/2 x 11 Case;13 10041;XtraLife? ClearVue? Slant-D? Ring Binders by Cardinal;10 10042;Computer Printout Paper with Letter-Trim Perforations;23 10043;6160;14 10045;Hoover Portapower? Portable Vacuum;51 10046;Timeport L7089;8 10047;Avery 510;26 10048;Xerox 1881;5 10049;LX 788;8 10051;Memorex 4.7GB DVD-RAM 3/Pack;34 10052;Unpadded Memo Slips;18 10054;Eldon Expressions? Desk Accessory Wood Pencil Holder Oak;21 10055;Bell Sonecor JB700 Caller ID;8 10056;Avery Arch Ring Binders;5 10057;APC 7 Outlet Network SurgeArrest Surge Protector;9 10058;Deflect-o RollaMat Studded Beveled Mat for Medium Pile Carpeting;20 10059;Accessory4;1 10060;Personal Creations? Ink Jet Cards and Labels;8 10061;High Speed Automatic Electric Letter Opener;5 10062;Xerox 1966;8 10063;Xerox 213;6 10064;Boston Electric Pencil Sharpener Model 1818 Charcoal Black;9 10065;Hammermill CopyPlus Copy Paper (20Lb. and 84 Bright);20 10066;Telephone Message Books with Fax/Mobile Section 5 1/2 x 3 3/16;18 10067;Crate-A-Files?;12 10068;Angle-D Binders with Locking Rings Label Holders;4 10069;80 Minute CD-R Spindle 100/Pack - Staples;8 10070;Bush Westfield Collection Bookcases Dark Cherry Finish Fully Assembled;21 10071;12-1/2 Diameter Round Wall Clock;18 10072;SAFCO Arco Folding Chair;4 10073;#10 White Business Envelopes;4 10074;3M Office Air Cleaner;24 10076;Xerox 1936;7 10078;Carina Double Wide Media Storage Towers in Natural & Black;10 10079;Staples? General Use 3-Ring Binders;4 10081;Luxo Professional Combination Clamp-On Lamps;43 10082;Xerox 217;9 10083;Revere Boxed Rubber Bands by Revere;22 10084;Acco Smartsocket? Table Surge Protector 6 Color-Coded Adapter Outlets;4 10085;Tennsco Snap-Together Open Shelving Units Starter Sets and Add-On Units;29 10086;Hon 4070 Series Pagoda? Round Back Stacking Chairs;10 10088;Xerox 1891;10 10089;Avery 506;9 10090;Bush Heritage Pine Collection 5-Shelf Bookcase Albany Pine Finish *Special Order;6 10091;Lifetime Advantage? Folding Chairs 4/Carton;23 10092;Microsoft Natural Multimedia Keyboard;22 10093;Staples Wirebound Steno Books 6 x 9 12/Pack;19 10094;GBC Pre-Punched Binding Paper Plastic White 8-1/2 x 11;8 10095;Bevis Boat-Shaped Conference Table;16 10096;Linden? 12 Wall Clock With Oak Frame;23 10097;Newell 326;3 10098;Prismacolor Color Pencil Set;10 10099;Xerox Blank Computer Paper;8 10100;600 Series Flip;30 

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_2

Step: 3

blur-text-image_3

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

HOW DO MANAGERS RANK INVESTMENT PROJECTS? LO.1

Answered: 1 week ago