Scope: Arrays and Loops
Sales collection
We’ll be collecting the names of up to 4 sales people.
For each person, we’ll collect how many of 3 different products they sold.
Determine the total $ amount sold by each person and the overall $ amount.
Application flow.
1. Prompt for the number of sales people.
2. Collect the names of them into an array.
3. For each person, prompt for each product (see below) and collect how many of those
were sold by that sales person. See below matrix for how to store it.
4. Calculate totals (see table below) and print that out.
Product Price
Printer $100
Paper $12
Ink $29
Person 1 Person 2 Person 3 Person 4
Printer 2 3 4 5
Paper 5 4 3 5
Ink 12 1 2 4
Example:
How many sales people? 4
Name of sales person 1: Bob
Name of sales person 2: Ann
Name of sales person 3: Kat
Name of sales person 4: Tim
How many printers sold by Bob? 2
How much paper sold by Bob? 5
How much ink sold by Bob? 12
… same for other 3 sales people
Bob sold $608
Ann sold …
Total sold ..