Problem

You are working for a company that has traveling salespeople. The salespeople call in th...

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 file sales.dat as a salesperson ID number, an item number, and a quantity, with all three items separated by blanks. There are 10 salespeople, with IDs of 1 through 10. The company sells eight different products, with IDs of 7 through 14 (some older products have been discontinued). The unit prices of the products are given here:

You have been asked to write a program that reads in the sales file, and generates a separate file for each salesperson containing just that individual’s 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 (quantity times unit price) 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 ID numbers. If a salesperson ID is invalid, write an error message to cout. If a product number is invalid, write the error message to the salesperson’s file and don’t compute a total for that sale. There should be ample opportunity to use Switch statements and value-returning functions in this application.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT