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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#include "Employee.h"
Employee::Employee(string first, string last, int pos2)
{
firstName = first;
lastName = last;
pos = pos2;
}
Employee::~Employee()
{
//will do something dont know what yet though.
}
HourlyWorker::HourlyWorker(string first, string last, int pos2) : Employee(first, last, pos2)
{
}
Manager::Manager(string first, string last, int pos2) : Employee(first, last, pos2)
{
}
OnCommission::OnCommission(string first, string last, int pos2) : Employee(first, last, pos2)
{
}
void Employee::print() const
{
cout << firstName << " " << lastName << endl;
}
float Employee::earnings() const
{
}
void HourlyWorker::print() const
{
Employee::print();
cout << " " << " earns " << earnings() << endl;
}
void HourlyWorker::setPay(double hours, double rate)
{
hourlyRate[pos] = rate;
hours[pos] = hours;
}
float HourlyWorker::earnings() const
{
return hourlyRate[pos]*hours[pos];
}
void Manager::print() const
{
Employee::print();
cout << " earns " << earnings() << endl;
}
void Manager::setPay(double money)
{
monthlyPay[pos] = money;
}
float Manager::earnings() const
{
return monthlyPay[pos];
}
void OnCommission::print() const
{
Employee::print();
cout << " has wages " << earnings() << endl;
}
void OnCommission::setPay(int items, double rate)
{
commission[pos] = rate;
quantity[pos] = items;
}
float OnCommission::earnings() const
{
return salary[pos] + commission[pos]*quantity[pos];
}
|