Advertisement
evcamels

lab-5_var-9

Dec 16th, 2021
1,133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. class worker{
  5.     string name;
  6.     int age;
  7. public:
  8.     void set_worker(string name, int age){
  9.         this->name = name;
  10.         this->age = age;
  11.     }
  12.     void info_worker(){
  13.         cout << "Имя работник: " << name << endl;
  14.         cout << "Возраст работника: " << age << endl;
  15.     }
  16. };
  17. class agronom: public worker{
  18.     int exp;
  19.     string type_product;
  20. public:
  21.     void set_agronom(int exp, string type_product){
  22.         this->exp = exp;
  23.         this->type_product = type_product;
  24.     }
  25.     void info_agronom(){
  26.         cout << "Стаж работы: " << exp << endl;
  27.         cout << "Агроном работает с: " << type_product << endl;
  28.     }
  29. };
  30. class firm{
  31.     string name_firm;
  32.     int capital;
  33.     string name_founder;
  34. public:
  35.     void set_firm(string name_firm, string name_founder, int capital){
  36.         this->name_firm = name_firm;
  37.         this->name_founder = name_founder;
  38.         this->capital = capital;
  39.     }
  40.     void info_firm(){
  41.         cout << "Название фирмы: " << name_firm << endl;
  42.         cout << "Учредитель: " << name_founder << endl;
  43.         cout << "Уставной капитал: " << capital << endl;
  44.     }
  45. };
  46. class worker_agro_firm: public firm{
  47.     int money;
  48.     int quanity_worker_day;
  49. public:
  50.     void set_agro(int money, int quanity_worker_day){
  51.         this->money = money;
  52.         this->quanity_worker_day = quanity_worker_day;
  53.     }
  54.     void info_agro(){
  55.         cout << "Зарплата: " << money << endl;
  56.         cout << "Количество рабочих дней: " << quanity_worker_day << endl;
  57.     }
  58. };
  59. class director_agro_firm: public firm{
  60.     int money, holiday;
  61. public:
  62.     void set_director(int money, int holiday){
  63.         this->money = money;
  64.         this->holiday = holiday;
  65.     }
  66.     void info_director(){
  67.         cout << "Зарплата директора: " << money << endl;
  68.         cout << "Количество отпусков: " << holiday << endl;
  69.     }
  70. };
  71. class agro_worker_agrcult: public firm{
  72.     int money;
  73.     string type_agro_cult;
  74. public:
  75.     void set_agr(int money, string type_agro_cult){
  76.         this->money = money;
  77.         this->type_agro_cult = type_agro_cult;
  78.     }
  79.     void info_agr(){
  80.         cout << "Зарплата работника агронома фермерского хозяйства: " << money << endl;
  81.         cout << "Работник агроном занимается: " << type_agro_cult << endl;
  82.     }
  83. };
  84. using namespace std;
  85. int main(){
  86.     agronom aa;
  87.     aa.set_worker("Malek", 35);
  88.     aa.info_worker();
  89.     aa.set_agronom(15, "rye");
  90.     aa.info_agronom();
  91.     worker_agro_firm a;
  92.     agro_worker_agrcult b;
  93.     director_agro_firm c;
  94.     a.set_firm("NLMK", "Johm", 10000);
  95.     a.info_firm();
  96.     a.set_agro(30000, 20);
  97.     a.info_agro();
  98.     a.info_firm();
  99.     c.set_director(90000, 3);
  100.     c.info_director();
  101.     a.info_firm();
  102.     b.set_agr(65000, "wheat");
  103.     b.info_agr();
  104.     return 0;
  105. }
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement