two dimensional array bouns calculating program

This is a class assignment and I'm stuck to say the least. I have been working on it most of yesterday and today with no luck. Up until now I've gotten everything pretty well. I have an A+ in the class but this has me about to pull my hair out.

We are supposed to store the sales amounts in a 2-dimensional array. The sales manager wants an application that allows him to enter a bonus rate. The program should display each salesperson's number, total sales amount, and total bonus amount. It should also display their monthly sales and total bonus paid to all salespeople.

I have got the numbers in the array and I can make it display what is in the array but i'm lost after that.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Salesperson         Jan.     Feb.     March
1                  2400     3500      2000
2                  1500     7000      1000
3                  600      450       2100
4                  790      240       500
5                  1000     1000      1000
6                  6300     7000      8000
7                  1300     450       700
8                  2700     5500      6000
9                  4700     4800      4900
10                 1200     1300      400


//Advanced25 Ch. 12
//Displays the bonus corresponding to the total sales of
//each salesperson

#include <iostream>
#include <iomanip>
using namespace std;



int main()
{
	//declare array and variables
	int salesAmounts[10][4] =  {{1, 2400, 3500, 2000},
				   {2, 1500, 7000, 1000},
				   {3, 600, 450, 2100},
				   {4, 790, 240, 500},
				   {5, 1000, 1000, 1000},
				   {6, 6300, 7000, 8000},
				   {7, 1300, 450, 700},
				   {8, 2700, 5500, 6000},
				   {9, 4700, 4800, 4900},
				   {10, 1200, 1300, 400}};
	

		for (int salesPerson = 0; salesPerson < 10; salesPerson ++)
		{
			for (int month = 0; month < 4; month ++)
				cout << " " << salesAmounts[salesPerson][month];
			cout << endl << endl;
		}



	return 0;
}	//end of main 
Last edited on
Couple of things, first and most important: remove your name from the post, and in the future, don't use your telephone number as the suffix of an account name.

Next to bat: You're storing information in the array that is extremely redundant,
1
2
3
	
int salesAmounts[10][4] =  {{1, 2400, 3500, 2000},
//salesAmounts[n][0] is always equal to n+1 


Finally, onto what you are really asking: Store the total sales of the employee in a temporary variable, display it, then multiply that by the bonus number, and display that.
Topic archived. No new replies allowed.