evcamels

lr-5_rewrite

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