Question: 1. Defines a struct containing a first name field (a string), a last name field (also a string), and weekly sales data field (a double).



1. Defines a struct containing a first name field (a string), a last name field (also a string), and weekly sales data field (a double). 2. Declares an array of these structs with NUM_SALESPEOPLE entries. 3. [Done for you] Opens the stream text file named sales_data.txt. If the file cannot be opened then write a descriptive error message and terminate execution. 4. Reads each line of the sales_data.txt file into a separate entry of the array. 5. Compute the combined weekly sales as well as the maximum individual sales amount while reading the sales_data.txt file. 6. Displays the combined and maximum weekly sales on the console: Combined weekly sales is $20892.6 Maximum weekly sales is $4523.11 The second part Add the following functionality to the first part: Use the array to compute the weekly payment to each salesperson and display it on the console. The payment is a 10% commission on their sales amount. In addition, the salespeople with the maximum weekly sales (there could be more than one) receive a $200 bonus. Payments should be rounded up to the nearest dollar: Combined weekly sales is $20892.6 Maximum weekly sales is $4523.11 Sales staff payments are: Justin Blake $323 Rachel Davide $413 Colin Forth $652 Diana Ince $310 Carol Marsh $98 Emma McNish $104 Phil Morgan $0 Sue Parsons $172 Boris Pullman $210 Dan Terry $6#include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
