Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Employee
- {
- private:
- string empName, hireDate;
- int empNumber;
- public:
- Employee()
- {
- empName = " ";
- empNumber = 0;
- hireDate = " ";
- }
- Employee(string name, int num, string d)
- {
- empName = name;
- empNumber = num;
- hireDate = d;
- }
- void setempName(string name)
- {
- empName = name;
- }
- void setempNumber(int num)
- {
- empNumber = num;
- }
- void sethireDate(string d)
- {
- hireDate = d;
- }
- string getempName() const
- {
- return empName;
- }
- int getempNumber() const
- {
- return empNumber;
- }
- string gethireDate() const
- {
- return hireDate;
- }
- void pay() const
- {
- cout << empName << " is employee number: " << empNumber << endl;
- }
- };
- class ProductionWorker :public Employee
- {
- private:
- int shift;
- double hourlyPay;
- public:
- ProductionWorker(string name, int num, int shift, double hourlypay)
- {
- setHourlyPay(hourlyPay);
- setShift(shift);
- }
- void setShift(int s)
- {
- shift = s;
- }
- void setHourlyPay(double hp)
- {
- hourlyPay = hp;
- }
- int getShift() const
- {
- return shift;
- }
- double gethourlyPay() const
- {
- return hourlyPay;
- }
- void details() const
- {
- cout << "The shift is: (1 for am, 2 for pm) " << shift << " and their hourly pay is: $" << hourlyPay << endl;
- }
- };
- class ShiftSupervisor :public Employee
- {
- private:
- double annualsalary;
- double bonus;
- public:
- ShiftSupervisor(string name, int num, double annualsalary, double bonus)
- {
- setempName(name);
- setannualsalary(annualsalary);
- setbonus(bonus);
- }
- void setannualsalary(double as)
- {
- annualsalary = as;
- }
- void setbonus(double b)
- {
- bonus = b;
- }
- double getannualsalary() const
- {
- return annualsalary;
- }
- double getbonus() const
- {
- return bonus;
- }
- void details() const
- {
- cout << "Annual salary is: " << annualsalary << " with a bonus of: " << bonus << endl;
- }
- };
- int main()
- {
- ShiftSupervisor supervisor("Darlene", 123, 100000, 5000);
- ProductionWorker worker("Jenna", 124, 1, 10);
- supervisor.pay();
- supervisor.setempName("Michael Jackson");
- supervisor.setempNumber(56);
- supervisor.setannualsalary(152500);
- supervisor.setbonus(500);
- supervisor.details();
- worker.pay();
- worker.setempName("Janet Jackson");
- worker.setempNumber(56);
- worker.setShift(1);
- worker.setHourlyPay(9);
- worker.details();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement