Answer:
<?php
abstract class Student {
public $Id; // field for student ID Number
public $Lastname; // field for student last name
public $Tuition; // field for annual tuition
public function __construct( $id, $lastname) { // constructor property to initialise id number and lastname
$this->Id = $id; // variable initialisation
$this->Lastname = $lastname;
}
// set Id number
public function setId($id) {
return $this->Id = $id;
}
// get id number
public function getId() {
return $this->Id;
}
// set lastname
public function setLastname($lastname) {
return $this->Lastname = $lastname;
}
// get lastname
public function getLastname() {
return $this->Lastname;
}
//the setTuition() method is abstract
abstract public function setTuition($amount);
// get Tuition fee
public function getTuition(){
return $this->Tuition;
}
}
// UndergraduateStudent is a subclass that inherits the properties of class Student
class UndergraduateStudent extends Student {
public function setTuition($amount) {
return $this->Tuition = $amount;
}
}
class GraduateStudent extends Student {
public function setTuition($amount) {
return $this->Tuition = $amount;
}
}
class StudentAtLarge extends Student{
public function setTuition($amount) {
return $this->Tuition = $amount;
}
}
// create an instance of the class
$Undergraduate = new UndergraduateStudent(1,"Anyadike");
// call all required methods
echo '<span> id: </span>'.$Undergraduate->getId();
echo '<span> name:</span>'.$Undergraduate->getLastname();
echo "<span> Tution:</span>".$Undergraduate->setTuition("$4000");
echo "<br>";
$GraduateStudent = new GraduateStudent(2,"Okonkwo");
echo '<span> id: </span>'.$GraduateStudent->getId();
echo '<span> name:</span>'.$GraduateStudent->getLastname();
echo "<span> Tution:</span>".$GraduateStudent->setTuition("$6000");
echo "<br>";
$StudentAtLarge = new StudentAtLarge(3,"Ojukwu");
echo '<span> id: </span>'.$StudentAtLarge->getId();
echo '<span> name:</span>'.$StudentAtLarge->getLastname();
echo "<span> Tution:</span>".$StudentAtLarge->setTuition("$2000");
?>
Explanation:
explanations are detailed in the comment (//)