Two-Dimensional Arrays

Jul 23, 2011 at 6:01pm
Hello all, I'm just learning how to program in c++ and I have a hw assignment that I'm very confused on if anyone can help that would be awesome! Here is my problem:

The sales manager wants an application that allows him to enter the current bonus rate. The program should display each salesperson's number (1 through 10), total sales amount, and total bonus amount. It also should display the total bonus paid to all salespeople. Using 10% bonus as the rate.

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

This is what I have so far...

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
#include <iostream>
using namespace std;

int main()
{
    double salesPerson[10][4] = {{2400, 3500, 2000},
                                 {1500, 7000, 1000},
                                 {600, 450, 2100},
                                 {790, 240, 500},
                                 {1000, 1000, 1000},
                                 {6300, 7000, 8000},
                                 {1300, 450, 700},
                                 {2700, 5500, 6000},
                                 {4700, 4800, 4900},
                                 {1200, 1300, 400}};
    double bonus = 0.0;

    for (int sales = 0; sales < 10; sales += 1)
        for (int months = 0; months < 3; months += 1)
        {
            cout << "Bonus for Sales Person "
                << sales + 1 << "Total "
                << months + 1 << ": ";
            cin >> salesPerson[sales][months];
        }
    for (int months = 0; months < 4; months +=1)
    {
        cout << " Bonus " << months + 1
            << ": ";
        cout << salesPerson[sales][months] << end1;
    }
}
    return 0;
}


I know I'm probably not even close here but I just am lost at what I'm supposed to do. Again any help is greatly appreciated! Thanks all.
Last edited on Jul 23, 2011 at 6:36pm
Jul 23, 2011 at 11:25pm
Jul 24, 2011 at 1:15am
I didn't see that post very sorry, but I'm not understanding what he means by storing the total sales of the employee in a temporary variable. Anyway you could explain what that means? Thank you very much!
Topic archived. No new replies allowed.