Use a two-dimensional array to solve the following problem. A company has four salespeople (1 to 4) who sell five different products (1 to 5). Once a month, each salesperson passes in a slip for each different product sold. Each slip contains the following:

  • the salesperson number
  • the product number
  • the total dollar value of that product sold that month

Thus, each salesperson passes in between 0 and 5 sales slips per month (for up to 5 products). Write a program that will read all this information for the sales (one salesperson at a time) and summarize the total sales by salesperson by product. All totals should be stored in the 2-dimensional array sales. After processing all the information for last month, print the results in tabular format with each of the columns representing a particular salesperson and each of the rows representing a particular product. Cross total each row to get the total sales of each product; cross total each column to get the total sales by a salesperson.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.