SHARE
TWEET

Untitled

a guest Nov 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Employee
  2. {
  3. private:
  4.    string empName, hireDate;
  5.    int empNumber;
  6. public:
  7.    Employee()
  8.    {
  9.        empName = " ";
  10.        empNumber = 0;
  11.        hireDate = " ";
  12.    }
  13.    Employee(string name, int num, string d)
  14.    {
  15.        empName = name;
  16.        empNumber = num;
  17.        hireDate = d;
  18.    }
  19.    void setempName(string name)
  20.    {
  21.        empName = name;
  22.    }
  23.    void setempNumber(int num)
  24.    {
  25.        empNumber = num;
  26.    }
  27.    void sethireDate(string d)
  28.    {
  29.        hireDate = d;
  30.    }
  31.    string getempName() const
  32.    {
  33.        return empName;
  34.    }
  35.    int getempNumber() const
  36.    {
  37.        return empNumber;
  38.    }
  39.    string gethireDate() const
  40.    {
  41.        return hireDate;
  42.    }
  43.    void pay() const
  44.    {
  45.        cout << empName << " is employee number: " << empNumber << endl;
  46.    }
  47.  
  48. };
  49. class ProductionWorker :public Employee
  50. {
  51. private:
  52.    int shift;
  53.    double hourlyPay;
  54. public:
  55.    ProductionWorker(string name, int num, int shift, double hourlypay)
  56.    {
  57.        setHourlyPay(hourlyPay);
  58.        setShift(shift);
  59.    }
  60.    void setShift(int s)
  61.    {
  62.        shift = s;
  63.    }
  64.    void setHourlyPay(double hp)
  65.    {
  66.        hourlyPay = hp;
  67.    }
  68.    int getShift() const
  69.    {
  70.        return shift;
  71.    }
  72.    double gethourlyPay() const
  73.    {
  74.        return hourlyPay;
  75.    }
  76.    void details() const
  77.    {
  78.        cout << "The shift is: (1 for am, 2 for pm) " << shift << " and their hourly pay is: $" << hourlyPay << endl;
  79.    }
  80. };
  81. class ShiftSupervisor :public Employee
  82. {
  83. private:
  84.    double annualsalary;
  85.    double bonus;
  86. public:
  87.    ShiftSupervisor(string name, int num, double annualsalary, double bonus)
  88.    {
  89.        setempName(name);
  90.        setannualsalary(annualsalary);
  91.        setbonus(bonus);
  92.    }
  93.    void setannualsalary(double as)
  94.    {
  95.        annualsalary = as;
  96.    }
  97.    void setbonus(double b)
  98.    {
  99.        bonus = b;
  100.    }
  101.    double getannualsalary() const
  102.    {
  103.        return annualsalary;
  104.    }
  105.    double getbonus() const
  106.    {
  107.        return bonus;
  108.    }
  109.    void details() const
  110.    {
  111.        cout << "Annual salary is: " << annualsalary << " with a bonus of: " << bonus << endl;
  112.  
  113.    }
  114. };
  115.  
  116. int main()
  117. {
  118.  
  119.    ShiftSupervisor supervisor("Darlene", 123, 100000, 5000);
  120.    ProductionWorker worker("Jenna", 124, 1, 10);
  121.    supervisor.pay();
  122.    supervisor.setempName("Michael Jackson");
  123.    supervisor.setempNumber(56);
  124.    supervisor.setannualsalary(152500);
  125.    supervisor.setbonus(500);
  126.    supervisor.details();
  127.    worker.pay();
  128.    worker.setempName("Janet Jackson");
  129.    worker.setempNumber(56);
  130.    worker.setShift(1);
  131.    worker.setHourlyPay(9);
  132.    worker.details();
  133.  
  134.    system("pause");
  135.    return 0;
  136. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top