"; echo"
"; class Person { // Properties public $name; public $telephone; public $email; //Construct method to initialise the three elements function __construct($name,$telephone,$email) { $this->name = $name; $this->telephone = $telephone; $this->email = $email; } // Methods function set_name($name) { $this->name = $name; } function get_name() { return $this->name; } function set_telephone($telephone) { return $this->telephone = $telephone; } function get_telephone() { return $this->telephone; } function set_email($email) { return $this->email = $email; } function get_email() { return $this->email; } //__toString() method to initialse the boolean value function __toString() { } } $details = new Person('Name: '." John Mwabilu", 'Telephone: '." 0741661964", 'Email: '." johnmwabilu@gmail.com"); echo $details->get_name(); echo "
"; echo $details->get_telephone(); echo "
"; echo $details->get_email(); //Task2 question B echo "
"; echo "
"; echo "B"; echo "
"; //Supper class // Parent class abstract class Payment { public $name; public function __construct($name) { $this->name = $name; } abstract public function intro() : string; } // Child classes class Salary extends Payment { public function intro() : string { return "$this->name!"; } } class Hourly extends Payment { public function intro() : string { return "$this->name!"; } } class Commission extends Payment { public function intro() : string { return "$this->name!"; } } // Create objects from the child classes $objSal = new Salary("Salary"); echo $objSal->intro(); echo "
"; $hour = new Hourly("Hourly"); echo $hour->intro(); echo "
"; $commiss = new Commission("Commission"); echo $commiss->intro(); echo "
"; ?>