Question 2 Use a double-subscripted array to solve the following problem. A company has four salespeople (1 to 4) who se
Posted: Fri May 20, 2022 11:26 am
Question 2 Use a double-subscripted array to solve the following problem. A company has four salespeople (1 to 4) who sell five different products (1 to 5). Each salesperson passes in slips for each different type of product sold. Each slip contains the following: The salesperson number The product number The total rand value of that product sold that day Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that the information from all of the slips for last month are available. Write a program that reads all this information for last month's sales and summarize the total sales by salesperson by product. . Allow the user to input the first names of the four employees. Limit the names to 20 characters. When generating the output table, use the names of the salespeople. To achieve this create an additional array that stores the names of all of the salespeople. 13 All totals should be stored in the two-dimensional array sales. After processing all the information for last month, print the results in tabular format with each of the columns represent a particular salesperson and each of the rows representing a particular product. Cross total each row to get the total sales of each product for last month; cross total each column to get the total sales by salesperson for last month. Your tabular printout should include these cross totals to the right of the totaled rows and to the bottom of the totaled columns. 13 Sample Output Enter salesperson 1's first name: Loyd Enter salesperson 2's first name: Clarah Enter salesperson 3's first name: Irene Enter salesperson 4's first name: Daviro Enter the salesperson (1 - 4), product number (1 - 5), and total sales. Enter -1 for the salesperson to end input. 1 1 9.99 1 2 12.49 1 5 19.98 2 3 15.75 24 21.23 3 1 17.33 4 5 22.22 4 1 19.65 -1 The total sales for each salesperson are displayed at the end of each row, and the total sales for each product are displayed at the bottom of each column. 1 2 3 4 5 Total Loyd 9.99 12.49 0.00 0.00 19.98 42.46 Clarah 0.00 0.00 15.75 21.23 0.00 36.98 Irene 17.33 0.00 0.00 0.00 0.00 17.33 Daviro 19.65 0.00 0.00 0.00 22.22 41.87 Total 46.97 12.49 15.75 21.23 42.20