Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here\'s the program problem You are working for a company that has traveling sal

ID: 3639833 • Letter: H

Question

Here's the program problem
You are working for a company that has traveling salespeople. The salespeople call in their sales to a fulfillment desk, where the sales are all entered into a file. Each sale is recorded as one line on the fil sales.dat as a salesperson ID number, an item number, and a quantity, all separated by blanks. There are 10 salespeople, with ID's of 1 through 10. The company sells eight different products, with ID's of 7 through 14. The unit prices of the products are:

Product Number Unit Price

7 345.00

8 853.00

9 471.00

10 933.00

11 721.00

12 663.00

13 507.00

14 259.00

You have been asked to write a program that reads in the sales file, and generates a separate file for each salesperson containing just their sales. Each line from the sales file is copied to the appropriate salesperson file(salespers1.dat through salespers10.dat), with the salesperson ID omitted. The total for the sale is appended to the record. At the end of processing, the total sales for each salesperson should be output with informative labels to cout. Use functional decomposition to design the program. Be sure that the program handles invalid numbers. If a salesperson ID is invalid, write out an error message to cout. If a product number is XXXXX write the error message to the salesperson's file and dont compute a total for that sale. There should be ample oppurtunity to use Switch statements and value-returning functions in this application.


I don't want anybody to write the program for me but i would like for somebody to point me in the right direction or give me an outline of what is should do because i'm confused. Thanks :D:D

Explanation / Answer

PS: Please rate the answer. You have to read a sales data sheet and calculate how much each sales guy has sold. Start by declaring arrays // the product prices float prices [numItems] = {345.0, 853.0, 471.0, 933.0, 721.0, 663.0, 507.0, 259.00}; // the product numbers int prodNum [numItems] = {7, 8, 9, 10, 11, 12, 13, 14}; // the salespersons IDs int salesP [numSalesP] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Now open input sales file // open the input file salesFile = fopen("sales.dat", "r"); For each sales guy, open an output file. It can be done this way int i; char fileName [16]; for (i=0; i