<?php
abstract class Department {
public $employees = array(); public $moneyConsumption;
public $coffeeConsumption;
public $reportsGeneration;
public $toogreeksPerPage;
public function name () {
}
}
class Purchasing extends Department {
public function __construct() {
$i = 0;
while ($i < 9){
$this->employees[] = new Manager(1, false);
$i = $i + 1;
}
}
}
class Sales extends Department {
}
class Marketing extends Department {
}
class Logistics extends Department {
}
abstract class Employee {
public $rank;
public $isBoss;
public $salary;
public $coffee;
public $reports;
public function countSalary($salary) {
if ($this->rank == 2) {
$salary = $salary * 1.25;
}elseif ($this->rank == 3) {
$salary = $salary * 1.5;
}
if ($this->isBoss == true) {
$salary = $salary * 1.5;
}
return $salary;
}
public function countCoffee($coffee) {
if ($this->isBoss == true) {
$coffee = $coffee * 2;
}
return $coffee;
}
public function countReports($reports) {
if ($this->isBoss == true) {
$reports = 0;
}
return $reports;
}
}
class Manager extends Employee {
public function __construct($rank, $isBoss) {
$salary = 500;
$coffee = 20;
$reports = 200;
$this->rank = $rank;
$this->isBoss = $isBoss;
$this->salary = $this->countSalary($salary);
$this->coffee = $this->countCoffee($coffee);
$this->reports = $this->countReports($reports);
}
}
class Marketer extends Employee {
public function __construct($rank, $isBoss) {
$salary = 400;
$coffee = 15;
$reports = 150;
$this->rank = $rank;
$this->isBoss = $isBoss;
$this->salary = $this->countSalary($salary);
$this->coffee = $this->countCoffee($coffee);
$this->reports = $this->countReports($reports);
}
}
class Engineer extends Employee {
public function __construct($rank, $isBoss) {
$salary = 200;
$coffee = 5;
$reports = 50;
$this->rank = $rank;
$this->isBoss = $isBoss;
$this->salary = $this->countSalary($salary);
$this->coffee = $this->countCoffee($coffee);
$this->reports = $this->countReports($reports);
}
}
class Analyst extends Employee {
public function __construct($rank, $isBoss) {
$salary = 800;
$coffee = 50;
$reports = 5;
$this->rank = $rank;
$this->isBoss = $isBoss;
$this->salary = $this->countSalary($salary);
$this->coffee = $this->countCoffee($coffee);
$this->reports = $this->countReports($reports);
}
}
$purchasing = new Purchasing;