Lab 2: File Handling - Inventory Consolidation CS1234: Small-Scale Application Development Problem Description You are the backend developer for a warehouse inventory system. The system generates a raw log file where every transaction is recorded separately. Consequently, the same item (e.g., ”Mango”) may appear multiple times in the file if stocks arrived in different batches. Your task is to consolidate this data. You must process the raw file to produce a final report where each item appears exactly once, with its quantities and calculated values aggregated. Write a C program that performs the following operations: 1. Input: Accept the input and output filename as a stdin. 2. Read & Aggregate: Read the tabular data from the file. • If an item ID appears multiple times, you must sum their Quantities and sum their Total Values (Calculated as Quantity × Price for each entry). • The input is not sorted; items may appear in any order. 3. File Output: Code should generate output file (filename passed in through STDIN) . The output must contain unique entries only, sorted by their ItemID. 4. Summary: Append a summary at the end showing the Grand Total Value of the warehouse and the count of items where the final aggregated quantity is Low (< 20). Input Format The input file contains multiple lines. Each line represents a transaction: Output Format The output file should list unique items sorted by ID, followed by the summary. --------------- Grand Total Value: Low Stock Items: Constraints Table 1: Data constraints for valid inputs ------------------------------------------- Field Data Type Constraints ------------------------------------------- ItemID int 1 ≤ ID ≤ 10,000 Unique Items N/A The file will contain at most 10,000 unique items. ItemName char array Single word, Max Length: 99 Quantity int Per entry: 1 ≤ Q ≤ 1000 PricePerUnit int Per entry: 1 ≤ P ≤ 1000 Calculated Value long long Aggregated sums can exceed 2 × 109 Sample Test Case Sample Input (in_1.txt) Note: IDs are not sorted. ID 2 appears before ID 1. ID 1 and ID 3 appear multiple times. 2 Gadget 50 10 1 Widget 10 100 3 Bolt 10 5 1 Widget 5 100 3 Bolt 10 5 Processing Logic • ID 1 (Widget): Two entries found. – Qty: 10 + 5 = 15 – Value: (10 × 100) + (5 × 100) = 1000 + 500 = 1500 • ID 2 (Gadget): One entry found. – Qty: 50 – Value: 50 × 10 = 500 • ID 3 (Bolt): Two entries found. – Qty: 10 + 10 = 20 – Value: (10 × 5) + (10 × 5) = 50 + 50 = 100 Sample Output (out_1.txt) 1 Widget 15 1500 2 Gadget 50 500 3 Bolt 20 100 --------------- Grand Total Value: 2100 Low Stock Items: 1 (Only Item 1 is ”Low” because 15 < 20. Item 3 has exactly 20, so it is safe.) Notes & Submission Guidelines • Sorting Logic: You must not use any built-in sorting functions (e.g., qsort). The sorting should happen naturally based on your data storage logic. • Output Formatting (needed for scripted evaluation): – The separator line preceding the summary must consist of exactly 16 dashes (-). – Ensure there is exactly one space between the label "Grand Total Value:" and the calculated number(same with ”Low Stock Items:” and calculated number). • File Naming: You must name your source file using your roll number (e.g., CS25B001.c). • Submission: Upload your single .c file to the Moodle Submission Portal.