I am extremely desperate. I need someone to write me a code by tomorrow night at
ID: 3576548 • Letter: I
Question
I am extremely desperate. I need someone to write me a code by tomorrow night at midnight. I am will ing to pay. Is there any way someone can help. It needs to be in the C lanuage. I have some done now, but I don't knwo how to finish it.
Here it is.
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:
Product Type
Product ID
Product Description
Product Price
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:
Order ID
Product ID
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 pseudo-code 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).
Test your project to ensure that it works properly. Copy your project to a compressed folder and upload it to Blackboard.
Good luck!
Explanation / Answer
#include<stdio.h>
#include<conio.h>
#include<math.h>
float distance(int, int, int, int);
void main()
initial purpose. ”);
scanf(“%d%d”,&x1,&y1);
printf(“Co-ordinate of 1st purpose is (%d, %d). ”,x1,y1);
printf(“Enter the Co-ordinates of second purpose. ”);
scanf(“%d%d”,&x2,&y2);
printf(“Co-ordinate of second purpose is (%d, %d). ”,x2,y2);
// The operate distance() is termed.
dist=distance(x1,y1,x2,y2);
printf(“The distance between 2 points is two units.”,dist);
getch();
}
float distance(int a1, int b1, int a2, int b2)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.