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.

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 #include #include using std: : cout; using std: : endl; using std: : ifstream; using std: :string; / / TODO: Define the EmployeeSales struct. int main( ) int return_code{ 0 }; const int NUM_SALESPEOPLE{ 10 }; const double COMMISSION{ 0. 10 }; const double BONUS{ 200.0 }; / / TODO: Declare an array of type EmployeeSales with NUM_SALESPEOPLE entries. const string sales_file_name{ "sales_data. txt" }; ifstream sales_file(sales_file_name) ; if (sales_file. is_open()) { / / TODO: Fill in the array using stream input from the sales_file. / / TODO: Compute and display the total and maximum sales. / / TODO: Compute and display the sales staff payments (for the second part of the assignment). else { cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!