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
|
// Preprocessor Directives
#include "stdafx.h"
#include "Hourly.h"
#include <iostream>
//----------------------------------------------------------------------------------------------
// Default Hourly Constructor
Hourly::Hourly():Employee(), minWage(10), maxWage(75), minHours(0), maxHours(50)
{
double wage = 0.0;
double hours = 0.0;
string category = "X";
}
//----------------------------------------------------------------------------------------------
// Multi-Arg Hourly Constructor #1
Hourly::Hourly(double wage, double hours, string category) : Employee(), minWage(10), maxWage(75), minHours(0), maxHours(50)
{
}
//----------------------------------------------------------------------------------------------
// Multi-Arg Hourly Constructor #2
Hourly::Hourly(string firstName, string lastName, char gender, int dependents, double wage, double hours, Benefit benefit, string category) :
Employee(firstName, lastName, gender, dependents, 0.0, benefit), minWage(10), maxWage(75), minHours(0), maxHours(50)
{
}
//----------------------------------------------------------------------------------------------
// Default Hourly Deconstructor
Hourly::~Hourly()
{
}
//----------------------------------------------------------------------------------------------
// CalculatePay Override Function
double Hourly::calculatePay()
{
return (wage * hours);
}
//----------------------------------------------------------------------------------------------
// Overloaded SetAnnualSalary
void Hourly::setAnnualSalary()
{
return Employee::setAnnualSalary(calculatePay()*50);
}
//----------------------------------------------------------------------------------------------
// DisplayEmployee Override Function
void Hourly::displayEmployee(void)
{
Employee::displayEmployee();
cout<<"Hourly Employee\n";
cout<<"Category:\t\t" << category << "\n";
cout<<"Wage:\t\t\t" << wage << "\n";
cout<<"Hours:\t\t\t" << hours << "\n";
}
//----------------------------------------------------------------------------------------------
// GetWage and SetWage Functions
double Hourly::getWage()
{
return wage;
}
void Hourly::setWage(double Wage)
{
wage = Wage;
}
//----------------------------------------------------------------------------------------------
//GetHours and SetHours Function
double Hourly::getHours()
{
return hours;
}
void Hourly::setHours(double Hours)
{
hours = Hours;
}
//----------------------------------------------------------------------------------------------
// GetCategory and SetCategory Functions
string Hourly::getCategory()
{
return category;
}
void Hourly::setCategory(string cat)
{
if( category == "temporary" || category == "part time" || category == "full time" )
category = cat;
else
category = "Unknown";
}
//----------------------------------------------------------------------------------------------
|