<?php
abstract class Employee{
public $salary;
public $pages;
public $cofee;
public $name;
function __construct($quantity, $rank){
$this->quantity = $quantity;
$this->rank = $rank;
}
function getSalary(){
$multiply=1;
switch($this->rank){
case 2:
$multiply=1.25;
break;
case 3:
$multiply=1.50;
break;
}
$getSalary=$this->salary*$multiply*$this->quantity;
return $getSalary;
}
function getCofee(){
$getCofee=$this->quantity*$this->cofee;
return $getCofee;
}
function getPages(){
$getPages=$this->quantity*$this->pages;
return $getPages;
}
}
class Manager extends Employee{
public $name="Менеджер";
public $salary = 500;
public $cofee = 20;
public $pages = 200;
}
class Market extends Employee{
public $name = "Маркетолог";
public $salary = 400;
public $cofee = 15;
public $pages = 150;
}
class Engineer extends Employee {
public $name = "Инженер";
public $salary = 200;
public $cofee = 5;
public $pages = 50;
}
class Analyst extends Employee {
public $name = "Аналитик";
public $salary = 800;
public $cofee = 50;
public $pages = 5;
}
class Department{
public $workers;
public $costs;
function __construct($name){
$this->name = $name;
return $this->name;
}
}
new Manager(9, 1),
new Manager(3, 2),
new Manager(2, 3),
new Market(2, 1),
'name'=>'закупок'
);
function createDepartment($data){
$department = new Department($data['name']);
foreach($data as $key=> $workers){
if($key=='name'){
continue;
}
echo $key;
}
}
createDepartment($department1);
PD9waHAKCmFic3RyYWN0IGNsYXNzIEVtcGxveWVlewoJCglwdWJsaWMgJHNhbGFyeTsKCXB1YmxpYyAkcGFnZXM7CglwdWJsaWMgJGNvZmVlOwoJcHVibGljICRuYW1lOwoJCgkKCWZ1bmN0aW9uIF9fY29uc3RydWN0KCRxdWFudGl0eSwgJHJhbmspewoJCQoJICAgICR0aGlzLT5xdWFudGl0eSA9ICRxdWFudGl0eTsKCSAgICAkdGhpcy0+cmFuayA9ICRyYW5rOwoJfQoJCglmdW5jdGlvbiBnZXRTYWxhcnkoKXsKCQkkbXVsdGlwbHk9MTsKCQlzd2l0Y2goJHRoaXMtPnJhbmspewoJCQljYXNlIDI6CgkJCQkkbXVsdGlwbHk9MS4yNTsKCQkJCW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