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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
#include <iostream>
#include <stdlib.h>
#include <string>
#include <iomanip>
using namespace std;
void displayDivider(string outputTitle)
{
cout << "**************** " + outputTitle + " ****************" << endl;
}
class benefit
{
private:
string healthInsurance;
double lifeInsurance;
int vacationDays;
string PPO;
string HMO;
public:
benefit();
benefit(string health, double life, int vacation);
void displayBenefit();
string getHealthInsurance();
void setHealthInsurance(string healthIns);
double getLifeInsurance();
void setLifeInsurance(double lifeIns);
int getVacationDays();
void setVacationDays(int vacation);
void BenefitInput();
};
benefit::benefit(string health, double life, int vacation)
{
healthInsurance = health;
lifeInsurance = life;
vacationDays = vacation;
}
string benefit::getHealthInsurance()
{
return healthInsurance;
}
void benefit::setHealthInsurance(string healthIns)
{
healthInsurance = healthIns;
}
double benefit::getLifeInsurance()
{
return lifeInsurance;
}
void benefit::setLifeInsurance(double lifeIns)
{
lifeInsurance = lifeIns;
}
int benefit::getVacationDays()
{
return vacationDays;
}
void benefit::setVacationDays(int vacation)
{
vacationDays = vacation;
}
void benefit::displayBenefit()
{
cout << "Health Insurance Type: " << healthInsurance << endl;
cout << "Life Insurance Amount: " << lifeInsurance << endl;
cout << "Vacation Days: " << vacationDays << " days" << endl;
}
benefit::benefit()
{
cout << "Please Enter the Health Insurance: ";
cin >> healthInsurance;
cout << "Please Enter the Life Insurance Amount: ";
cin >> lifeInsurance;
while (lifeInsurance < 0 || lifeInsurance > 1000000)
{
cout << "Please Enter A Dollar Amount: ";
cin >> lifeInsurance;
}
cout << "Please Enter the Amount of Vacation Days: ";
cin >> vacationDays;
while (vacationDays < 0 || vacationDays > 40)
{
cout << "Please Enter Vacation days Between 0 And 40: ";
cin >> vacationDays;
}
}
class Employee
{
protected:
string firstName;
string lastName;
char gender;
int dependents;
double annualSalary;
benefit Benefit;
public:
Employee();
Employee(string first, string last, char gen, int dep, double salary);
double calculatePay();
void displayEmployee();
string getFirstName();
void setFirstName(string first);
string getLastName();
void setLastName(string last);
char getGender();
void setgender(char gen);
int getDependents();
void setDependents(int dep);
void setDependents(string dep);
double getAnnualSalary();
void setAnnualSalary(double salary);
void setAnnualSalary(string salary);
static int getNumEmployees();
static int numEmployees;
};
Employee::Employee()
{
firstName = "Not Given";
lastName = "Not Given";
gender ='U';
dependents = 0;
annualSalary = 20000;
cout << "Please Enter First Name: ";
cin >> firstName;
cout << "Please Enter Last Name: ";
cin >> lastName;
cout << "Please Enter Gender: ";
cin >> gender;
cout << "Please Enter Dependent Count: ";
cin >> dependents;
cout << "Please Enter Yearly Salary: ";
cin >> annualSalary;
}
Employee::Employee(string first, string last, char gen, int dep, double salary)
{
firstName = first;
lastName = last;
gender = gen;
dependents = dep;
annualSalary = salary;
}
string Employee::getFirstName()
{
return firstName;
}
void Employee::setFirstName(string first)
{
firstName = first;
}
string Employee::getLastName()
{
return lastName;
}
void Employee::setLastName(string last)
{
lastName = last;
}
char Employee::getGender()
{
return gender;
}
void Employee::setgender(char gen)
{
gender = gen;
}
int Employee::getDependents()
{
return dependents;
}
void Employee::setDependents(int dep)
{
dependents = dep;
}
void Employee::setDependents(string dep)
{
dependents = atoi(dep.c_str());
}
double Employee::getAnnualSalary()
{
return annualSalary;
}
void Employee::setAnnualSalary(double salary)
{
annualSalary = salary;
}
void Employee::setAnnualSalary(string salary)
{
annualSalary = atof(salary.c_str());
}
double Employee::calculatePay()
{
return annualSalary/52;
}
int Employee::getNumEmployees()
{
return numEmployees;
}
void Employee::displayEmployee()
{
cout << "Employee Information" << endl;
cout << "___________________________________________________________________________________________" << endl;
cout << endl;
cout << "First Name: " << firstName << endl;
cout << "Last Name: " << lastName<< endl;
cout << "Gender: " << gender << endl;
cout << "Dependent(s): " << dependents << endl;
cout << "Annual Salary: " << setprecision(2) << showpoint << fixed << annualSalary << endl;
cout << "Weekly Pay: " << calculatePay() << endl;
cout << endl;
cout << "Benefit Information" << endl;
cout << "___________________________________________________________________________________________" << endl;
Benefit.displayBenefit();
cout << endl;
};
class Salaried : public Employee
{
private:
const int MIN_MANAGEMENT_LEVEL = 0;
const int MAX_MANAGEMENT_LEVEL = 3;
const double BONUS_PERCENT = .10;
int managementLevel;
public:
Salaried();
Salaried(string, string, char, int, double, benefit, int);
double calculatePay();
void displayEmployee();
int getManagementLevel();
void setManagementLevel(int);
Salaried()
{
managementLevel = 0;
}
Salaried(string firstName, string lastName, char gender, int dependents, double salary, benefit (mybenefits), int manLevel) :Employee(string firstName, string lastName, char gender, int dependents, double salary, Benefit mybenefits):benefits(mybenefits) )
{
this->firstName = firstName;
this->lastName = lastName;
this->gender = gender;
this->dependents = dependents;
this->annualSalary = salary;
this->numEmployees += 1;
}
Salaried(double sal, int manLevel)
{
}
double calculatePay()
{
return Employee::calculatePay() * (1 + (managementLevel*BONUS_PERCENT));
}
void displayEmployee()
{
cout<<"Employee Information\n";
cout<<"____________________________________________________________\n";
cout<<"Name: \t\t" <<firstName << " " << lastName << "\n";
cout<<"Gender:\t\t" << gender << "\n";
cout<<"Dependents: \t" << dependents << "\n";
cout<<"Annual Salary:\t" << setprecision(2)<<showpoint<<fixed<<annualSalary << "\n";
cout<<"Weekly Salary:\t" << setprecision(2)<<showpoint<<fixed<<calculatePay()<<"\n";
cout<<"Management Level: "<< managementLevel << endl;
this->benefits.displayBenefits();
}
int getManagementLevel()
{
return managementLevel;
}
void setManamentLevel(int manLevel);
class Hourly : public Employee
{
private:
const double MIN_WAGE = 10;
const double MAX_WAGE = 75;
const double MIN_HOURS = 0;
const double MAX_HOURS = 50;
double wage;
double hours;
string category;
public:
Hourly();
Hourly(double, double, string);
double calculatePay();
void setAnnualSalary();
void displayEmployee();
double getWage();
void setWage(double);
double getHours();
void setHours(double);
string getCategory();
void setCategory(string);
Hourly()
{
double wage = 0.0;
double hours = 0.0;
string category = "X";
}
Hourly(double wage, double hours, string category)
{
}
|