## PROBLEM 6.22 - ANALYSIS

### INPUT VARIABLES

Description
Name
Data Type
Rationale
array to hold the entered sales totals sales[4][5] float This array will hold sales totals (dollar values, which are decimal values) for 4 people and 5 products.
salesperson's number salesPerons int problem states that the salespeople are numbered 1 through 4 (integer values)
product's number product int problem states that the products are numbered 1 through 5 (integer values)
value of the sales made value float sales are dollar values (which are decimal values)

### INTERMEDIATE VARIABLE

Description
Name
Data Type
Rationale
loop counters i, j int counting numbers are integers

### OUTPUT VARIABLES

Description
Name
Data Type
Rationale
array to keep track of running totals by product productSales[5] float dollar values are decimal values
total value of the sales of each salesperons totalSales float dollar values are decimal values

### ALGORITHM

For main:

1. Declare and initialize variable.

2. Call the function to read in the sales from the user

3. Call the funtion to display the table header

4. Call the function to display the sales

For getSales:

1. Declare local variables

2. Prompt user for input

3. While user has not entered sentinel value (-1)

3.2 Prompt user for input

1. Display explanation

For printSales:

1. Declare and initialize local variables

2. Loop through each salesperson

2.1 Initialize salesperson's running total to 0

2.2 Print product number

2.3 Loop through each product

2.3.1 Add sales to the salesperson's running total

2.3.2 Add sales to the product's running total

2.3.2 Display the sales for the current product and salesperson

2.4 Display the salesperson's total
3. Display the product totals