-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployee.cpp
44 lines (30 loc) · 970 Bytes
/
Employee.cpp
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
/* Employee class source file */
#include "Employee.h"
// constructor
Employee::Employee(string n, float baseSal)
: name(n), baseSalary(baseSal), totalSalary(0), commission(0), \
commissionTotal(0)
{}
// add a sale to an employee ands sum the new commission
void Employee::newSale(InsurancePolicy *a)
{
a->calcCommission(); // calculate only the commission for the new policy
sales.push_back(a); // add new policy to the employee's sales
// sums commission made by the employee from each policy
float tmp;
for (int i=0; i < sales.size(); i++)
{
tmp += sales[i]->getCommission();
}
commission = tmp;
}
// print policy info for each policy sold by employee
void Employee::printSales()
{
for (int c=0; c < sales.size(); c++)
{
cout << "***************************************************" << endl;
cout << *sales[c];
cout << "***************************************************" << endl;
}
}