$20.99
OBJECTIVES:
This lab task serves as a revision that covers the topics file input/output, struct, CString, and functions.
TASKS:
You are responsible to maintain a simple sales record for the sales employees of a company. The company keeps a master file to store the records of the current salespersons which contains the employee number, name, and sales made for each customer. The file may be formatted in the following way:
12345 Joe Lim KH 879.00
12233 Kay Suet Yee 35.98
23781 Leong Jing Yang 10.00
67543 Woon Tian Yi 500.50
Whenever sales are made during a week, the detail of each of the transaction is entered into a transaction file. The transaction file will contain the employee number and the transaction amount for the salesperson that has secured a sale. The same salesperson may have made several sales in a week and several salespersons may not have any sales during that week. If no sales made, then no record will be kept in the transaction file for this employee. Sometimes, there will be new salesperson joining the company and the details are not yet available in the master file. The transaction file may look like follows:
23781 1000.00
99988 80.30
67543 200.50
23781 199.00
12345 1040.00
67543 67.50
Your task is to write a program that will read a transaction file and use it to create an updated version of the master file. New records should be created and old records updated. In the case of a new record, the name should be prompted before adding to the master file. At the end of the program, a new master file should be created which will be used in the next update. After each update done, print out also (on standard output) the total sales made for that week and the overall total sales made so far. Filenames should be entered by the user (master and transaction).
Declare suitable data structure to keep each record. Use individual functions to perform the updates, calculations and display. Include necessary error checking in your program and provide a well-formatted output.