fork download
  1. <?php
  2.  
  3. class Department
  4. {
  5. //манагеры
  6. public $ma1;
  7. public $ma2;
  8. public $ma3;
  9. //маркетологи
  10. public $mar1;
  11. public $mar2;
  12. public $mar3;
  13. //аналисты
  14. public $an1;
  15. public $an2;
  16. public $an3;
  17. //инженеры
  18. public $eng1;
  19. public $eng2;
  20. public $eng3;
  21.  
  22. public $head;
  23.  
  24. public $name;
  25.  
  26. function __construct($name)
  27. {
  28. $this->name = $name;
  29. }
  30. function totalEmployee()
  31. {
  32. $total = 0;
  33. $total = $this->ma1 + $this->ma2 + $this->ma3 + $this->mar1 + $this->mar2 + $this->mar3 + $this->an1 + $this->an2 + $this->an3 + $this->eng1 + $this->eng2 + $this->eng3 + 1;
  34. return $total;
  35. }
  36.  
  37. }
  38.  
  39. function dataFill($department)
  40. {
  41. $var = new Department($department['name']);
  42. $var->ma1 = $department['ma1'];
  43. $var->ma2 = $department['ma2'];
  44. $var->ma3 = $department['ma3'];
  45. $var->mar1 = $department['mar1'];
  46. $var->mar2 = $department['mar2'];
  47. $var->mar3 = $department['mar3'];
  48. $var->eng1 = $department['eng1'];
  49. $var->eng2 = $department['eng2'];
  50. $var->eng3 = $department['eng3'];
  51. $var->an1 = $department['an1'];
  52. $var->an2 = $department['an2'];
  53. $var->an3 = $department['an3'];
  54. $var->head = $department['head'];
  55. return $var;
  56.  
  57.  
  58. }
  59.  
  60. $department = array();
  61. //название отдела
  62. $department['name'] = "Департамент продаж";
  63. //Менеджеры каждого ранга
  64. $department['ma1'] = 9;
  65. $department['ma2'] = 3;
  66. $department['ma3'] = 2;
  67. //маркетологи каждого ранга
  68. $department['mar1'] = 2;
  69. $department['mar2'] = 0;
  70. $department['mar3'] = 0;
  71. //инженеры каждого ранга
  72. $department['eng1'] = 0;
  73. $department['eng2'] = 0;
  74. $department['eng3'] = 0;
  75. //аналитики каждого ранга
  76. $department['an1'] = 0;
  77. $department['an2'] = 0;
  78. $department['an3'] = 0;
  79. //должность руководителя
  80. $department['head'] = 'ma2';
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Standard output is empty