fork download
  1. <?php
  2.  
  3.  
  4. class Employees {
  5. public $department;
  6. public $profession;
  7. public $coffee;
  8. public $rank;
  9. public $boss;
  10. public $pages;
  11. public $salary;
  12. public $rate;
  13.  
  14. public function __construct($department, $profession, $coffee, $rank, $boss, $pages, $basicSalary)
  15. {
  16. $this->department = $department;
  17. $this->profession = $profession;
  18. $this->coffee = $coffee;
  19. $this->rank = $rank;
  20. $this->boss = $boss;
  21. $this->pages = $pages;
  22. $this->basicSalary = $basicSalary;
  23. }
  24.  
  25. public function getRate()
  26. {
  27. if ($this->rank == 1) {
  28. $this->rate = 1;
  29. } elseif ($this->rank == 2) {
  30. $this->rate = 1.25;
  31. } elseif ($this->rank == 3) {
  32. $this->rate = 1.5;
  33. }
  34. }
  35. public function getSalary($basicSalary)
  36. {
  37. $this->salary = $basicSalary * $this->rate;
  38. }
  39. }
  40.  
  41. $employees = array(
  42. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  43. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  44. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  45. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  46. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  47. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  48. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  49. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  50. new Employees('Закупки', 'Me', 20, false, 1, 200, 500),
  51.  
  52. new Employees('Закупки', 'Me', 20, false, 2, 200, 500),
  53. new Employees('Закупки', 'Me', 20, false, 2, 200, 500),
  54. new Employees('Закупки', 'Me', 20, false, 2, 200, 500),
  55.  
  56. new Employees('Закупки', 'Me', 20, false, 3, 200, 500),
  57. new Employees('Закупки', 'Me', 20, false, 3, 200, 500),
  58.  
  59. new Employees('Закупки', 'Ma', 15, false, 2, 150, 400),
  60. new Employees('Закупки', 'Ma', 15, false, 2, 150, 400),
  61.  
  62. new Employees('Закупки', 'Me', 20, true, 2, 200, 500)
  63. );
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Standard output is empty