fork download
  1. <?php
  2.  
  3. abstract class Employee {
  4. const MANAGER = "Manager";
  5. const MARKETER = "Marketer";
  6. const ENGINEER = "Engineer";
  7. const ANALYST = "Analyst";
  8.  
  9. protected int $grade;
  10. protected bool $chief;
  11.  
  12. public function __construct(int $grade, bool $chief = false) {
  13. $this->grade = $grade;
  14. $this->chief = $chief;
  15. }
  16.  
  17. public function getBaseRate() {
  18. return $this->baseRate;
  19. }
  20.  
  21. public function getActualPay() {
  22. $rate = $this->getBaseRate();
  23. if ($this->grade == 2) {
  24. $rate *= 1.25;
  25. } elseif ($this->grade == 3) {
  26. $rate = $rate * 1.5;
  27. }
  28.  
  29. return $this->chief ? $rate * 2 : $rate;
  30. }
  31.  
  32. public function getBaseCoffeeConsumption() {
  33. return $this->baseCoffeeConsumption;
  34. }
  35.  
  36. public function getActualCoffeeConsumption() {
  37. return $this->chief ? $this->getBaseCoffeeConsumption() * 2 : $this->getBaseCoffeeConsumption();
  38. }
  39.  
  40. public function getBasePaperworkProduced() {
  41. return $this->basePaperworkProduced;
  42. }
  43.  
  44. public function getActualPaperworkProduced(): int {
  45. return $this->chief ? 0 : $this->getBasePaperworkProduced();
  46. }
  47. }
  48.  
  49. class Manager extends Employee {
  50. protected $baseRate = 500;
  51. protected $baseCoffeeConsumption = 20;
  52. protected int $basePaperworkProduced = 200;
  53. }
  54.  
  55. class Marketer extends Employee {
  56. protected $baseRate = 400;
  57. protected $baseCoffeeConsumption = 15;
  58. protected int $basePaperworkProduced = 150;
  59. }
  60.  
  61. class Engineer extends Employee {
  62. protected $baseRate = 200;
  63. protected $baseCoffeeConsumption = 5;
  64. protected int $basePaperworkProduced = 50;
  65. }
  66.  
  67. class Analyst extends Employee {
  68. protected $baseRate = 800;
  69. protected $baseCoffeeConsumption = 50;
  70. protected int $basePaperworkProduced = 5;
  71. }
Runtime error #stdin #stdout #stderr 0.02s 24152KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /home/Zqli11/prog.php on line 9