Requirements
Write a C
program, named a2.c, to solve the following
problem.
A
company has 4 salespeople (1 to 4) who sell 5 different products (1 to 5). Every
day the company maintains a CSV file for each product sold. A CSV file is a
comma-separated values file. The CSV file contains the product, and the total
dollar value of that product sold by each salesperson that day. An example CSV
file has been provided with the assignment.
Write a
program that will read all this information for a day’s sales and summarize the
total sales by salesperson and by product. After processing all the information
for the day, display the results in a tabular format, with each column
representing a salesperson and each row representing a particular product. Gross
total each row to get the total sales of each product. Gross total each column
to get the total sales by salesperson. Your output should include these
cross-totals to the right of the totaled rows and to the bottom of the totaled
columns.
For the
sample data provided with the assignment the output could look like this
Seller1 Seller2 Seller3 Seller4
Total
Product1
915 777 886 383 2961
Product2
492 386 335 793 2006
Product3
27 362 421 649 1459
Product4
926 763 59
690 2438
Product5
736 172 426 540 1874
Total 3096 2460 2127 3055 0
Tips
·
You may assume that each line in the
CSV file is not larger than a number of your choice, say no larger than 256.
·
You may assume that there are no
spaces or other special characters in the names of the salespeople or products.
·
You may assume that the names of
salespeople and products are not larger than a number of your choice, say no
larger than 20.
·
You can use character arrays. You do
not need to dynamically allocate memory for this assignment.
What to submit
Submit the C program a2.c in Blackboard.
Get Free Quote!
260 Experts Online