Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.44 KB | None | 0 0
  1. #ifndef __LAB11_EMPLOYEES_H_INCLUDED
  2. #define __LAB11_EMPLOYEES_H_INCLUDED
  3. #include <iostream>
  4. #include <stdint.h>
  5. using namespace std;
  6.  
  7. class Employee{
  8. public:
  9.     Employee(char * name, int32_t salary);
  10.     Employee();
  11.     ~Employee();
  12.     virtual int salary() const = 0;
  13.     virtual ostream& output(ostream &st) = 0;
  14.     virtual ofstream& output(ofstream &st) = 0;
  15.     virtual istream& input(istream &st) = 0;
  16.     virtual ifstream& input(ifstream &st) = 0;
  17.     friend std::ostream& operator<<(ostream &st, Employee &e);
  18.     friend std::ofstream& operator<<(ofstream &st, Employee &e);
  19.     friend std::istream& operator>>(istream &st, Employee &e);
  20.     friend std::ifstream& operator>>(ifstream &st, Employee &e);
  21. private:
  22.     char *_name;
  23.     int32_t _base_salary;
  24. };
  25.  
  26. class Developer: public Employee {
  27. public:
  28.     Developer(char*,  int32_t, bool);
  29.     Developer();
  30.     ostream& output(ostream &st);
  31.     istream& input(istream &st);
  32.     ofstream& output(ofstream &st);
  33.     ifstream& input(ifstream &st);
  34.     int salary() const {
  35.         int salary = _base_salary;
  36.         if (_has_bonus) { salary += 1000; }
  37.         return salary;
  38.     }
  39. private:
  40.     Developer(const Developer&){};
  41.     Developer& operator=(const Developer& link){return *this;};
  42.     char *_name;
  43.     int32_t _base_salary;
  44.     bool _has_bonus;
  45. };
  46.  
  47. class SalesManager: public Employee {
  48. public:
  49.     SalesManager(char* , int32_t, int32_t, int32_t);
  50.     SalesManager();
  51.     ostream& output(ostream &st);
  52.     istream& input(istream &st);
  53.     ofstream& output(ofstream &st);
  54.     ifstream& input(ifstream &st);
  55.     int salary() const {
  56.         return _base_salary + _sold_nm * _price * 0.01;
  57.     }
  58. private:
  59.     SalesManager(const SalesManager&){};
  60.     SalesManager& operator=(const SalesManager &link){return *this;};
  61.     char *_name;
  62.     int32_t _base_salary;
  63.     int32_t _sold_nm, _price;
  64. };
  65.  
  66. class EmployeesArray {
  67. public:
  68.     EmployeesArray(int32_t);
  69.     ~EmployeesArray();
  70.     friend std::ostream& operator<<(ostream &os, EmployeesArray &e);
  71.     friend std::ofstream& operator<<(ofstream &os, EmployeesArray &e);
  72.     friend std::ifstream& operator>>(ifstream &os, EmployeesArray &e);
  73.     std::ostream& outar(ostream &os);
  74.     std::ofstream& outar(ofstream &os);
  75.     std::ifstream& outar(ifstream &os);
  76.     void add(const Employee *e);
  77.     int total_salary() const;
  78. private:
  79.     Employee **_employees;
  80.     int32_t sz;
  81.     int32_t capacity;
  82. };
  83.  
  84. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement