Question: Complete on C To complete this project, you will need to code functions to read two files, one with data about products and another with

"Complete on C" To complete this project, you will need to code functions to read two files, one with data about products and another with orders for these products. The data file for the products (Products.csv) has five columns: 1. Product Type 2. Product ID 3. Product Description 4. Product Price 5. Quantity of Product in Stock The contents of the product file are: Book,B123,The Hunt for Red October,12.99,28 Software,S123,Starcraft,16.99,12 Music,C123,Led Zeppelin,9.99,65 Movie,D123,The Hunt for Red October,14.99,34 Contents of Products.csv The data file for orders (Orders.csv) has three columns: 1. Order ID 2. Product ID 3. Quantity of Product Ordered The contents of the orders file are: 12,B123,1 12,D123,2 13,C123,1 13,D123,1 16,S123,3 19,B123,2 19,D123,2 23,C123,1 26,S123,2 32,B123,1 32,C123,1 32,D123,1 32,S123,1 Contents of Orders.csv The task is to calculate the subtotal, tax (at 6%) and total for each order and to decrease the products quantity in stock to reflect all orders. The compressed folder contains some code examples to help you with the project. I suggest following this process to complete this project: Create main function and include necessary libraries. Write code for a struct to contain data for products (named product_t) and a struct to contain orders (order_t). A struct should be able to store one item from the file. Write code for a struct containing an array of products (named product_array_t) and a struct containing an array of orders (named order_array_t). These structs should have variables to represent the array and to record the pre-allocated length of the array and the count of items in the array. Write a function to read products from the products file to the product array (named read_products) and another to read orders from the orders data file to the orders array (named read_orders). You will need to pass the identifiers by reference from the main function to do this. Write functions to print the contents of the product and order arrays to screen. Each will require two functions: one to write the data from one struct and another to repetitively call this function to print the whole array. These files should be named print_product, print_products, print_order, and print_orders. Write a method to sort (selection or bubble) the array of products by Product ID (named sort_products). Remember that the array (struct) identifier will need to be passed by reference. I suggest writing a separate swap function to swap product positions in the array (named swap). Write a function to search the products using a binary search (named search). You should use your print functions to test the sort and search. Write a function to process the data for products and orders (named process). The suggested pseudocode is: // Function to process product orders // Accepts: reference to product array // value of order array // Returns: Grand total of orders // Declare index ints for order and product arrays // Declare and initialize doubles to 0 for order total // and grand total // Declare an int to keep track of current order // Loop through all orders // Use search to get price for order product // Accumulate grand total // Accumulate order total // Remove order qty from product qty // If a new order number is next - print this order // total to screen and reinitialize order total to 0 // After loop is complete - print last order to screen // Return grand total Pseudo-code for process orders function Write a function to write the current products to file with updated quantities (named write_products). Make sure to use a different name than the input file (maybe Products2.csv).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!