<?php
// final no deja sobre escribir
class Persona {
//put your code here
private $cedula;
private $nombre;
private $apellido;
private $edad;
function __construct($cedula, $nombre, $apellido, $edad) {
$this->cedula = $cedula;
$this->nombre = $nombre;
$this->apellido = $apellido;
$this->edad = $edad;
}
public final function getCedula() {
return $this->cedula;
}
public final function getNombre() {
return $this->nombre;
}
public function getApellido() {
return $this->apellido;
}
public final function getEdad() {
return $this->edad;
}
public final function setCedula($cedula) {
$this->cedula = $cedula;
}
public final function setNombre($nombre) {
$this->nomre = $nombre;
}
public function setApellido($apellido) {
$this->apellido = $apellido;
}
public final function setEdad($edad) {
$this->edad = $edad;
}
}
?>
<?php
include_once 'Persona.php';
class Estudiante extends Persona {
//put your code here
private $codigo;
private $programa;
private $semestre;
private $valormatri;
function __construct($cedula, $nombre, $apellido, $edad, $codigo, $programa, $semestre, $valormatri) {
parent::__construct($cedula, $nombre, $apellido, $edad);
$this->codigo = $codigo;
$this->programa = $programa;
$this->semestre = $semestre;
$this->valormatri = $valormatri;
}
public function getCodigo() {
return $this->codigo;
}
public function getPrograma() {
return $this->programa;
}
public function getSemestre() {
return $this->semestre;
}
public function getValormatri() {
return $this->valormatri;
}
public function setCodigo($codigo) {
$this->codigo = $codigo;
}
public function setPrograma($programa) {
$this->programa = $programa;
}
public function setSemestre($semestre) {
$this->semestre = $semestre;
}
public function setValormatri($valormatri) {
$this->valormatri = $valormatri;
}
}
?>
------------------------------------------------------<?php
include_once 'Persona.php';
class Empleado extends Persona {
//put your code here
private $codigoemp;
private $cargo;
private $salario;
private $vinculacion;
function __construct($cedula, $nombre, $apellido, $edad, $codigoemp, $cargo, $salario, $vinculacion) {
parent::__construct($cedula, $nombre, $apellido, $edad);
$this->codigoemp = $codigoemp;
$this->cargo = $cargo;
$this->salario = $salario;
$this->vinculacion = $vinculacion;
}
public function getCodigoemp() {
return $this->codigoemp;
}
public function getSalario() {
return $this->salario;
}
public function getVinculacion() {
return $this->vinculacion;
}
public function getCargo() {
return $this->cargo;
}
public function setCodigoemp($codigoemp) {
$this->codigoemp = $codigoemp;
}
public function setSalario($salario) {
$this->salario = $salario;
}
public function SetCargo($cargo) {
$this->cargo= $cargo;
}
public function setVinculacion($vinculacion) {
$this->vinculacion = $vinculacion;
}
}
?>
-------------------------------------------------------------<?php
include_once 'Persona.php';
include_once 'Empleado.php';
include_once 'Estudiante.php';
class EstudianteEmpleado extends Empleado {
private $codigo;
private $programa;
private $semestre;
private $valormatri;
function __construct($cedula, $nombre, $apellido, $edad, $codigo, $programa, $cargo, $semestre, $salario, $codigoemp, $vinculacion, $valormatri) {
parent::__construct($cedula, $nombre, $apellido, $edad, $codigoemp, $cargo, $salario, $vinculacion);
$this->codigo = $codigo;
$this->programa = $programa;
$this->semestre = $semestre;
$this->valormatri = $valormatri;
}
}
?>
-------------------------------------------<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
include_once 'EstudianteEmpleado.php';
include_once 'Empleado.php';
include_once 'Estudiante.php';
include_once 'Persona.php';
$v = array();
$est = new Estudiante(88824, "Ana", "Lazuli", 18, 151310178, "Ingenieria", 4, 1800000);
$emp = new Empleado(46548, "Luisa", "Perez", 19, 18902453, "secretaria", 1000000, "medio tiempo");
$est1 = new Estudiante(88858, "Julio", "Osorio", 18, 151311178, "Ingenieria", 3, 1750000);
$emp1 = new Empleado(88824, "Ana", "Lazuli", 18, 151310128, "jardinero", 800000, "tiempo completo");
$ee = new EstudianteEmpleado(88824, "Ana", "Lazuli", 18, 151310178, "Ingenieria", "jardinero", 4, 800000, 151310128, "tiempo completo", 1800000);
$v[0] = $est;
$v[1] = $emp;
$v[2] = $est1;
$v[3] = $emp1;
$v[4] = $ee;
for ($i = 0; $i < count($v); $i++) {
if ($v[$i]instanceof Estudiante) {
echo 'ESTUDIANTE </br>';
echo'La Cedula Es --->' . " " . $v[$i]->getCedula() . "</br>";
echo'El Nombre Es --->' . " " . $v[$i]->getNombre() . "</br>";
echo'El Apellido Es --->' . " " . $v[$i]->getApellido() . "</br>";
echo'La Edad Es --->' . " " . $v[$i]->getEdad() . "</br>";
echo'El Codigo Es --->' . " " . $v[$i]->getCodigo() . "</br>";
echo'El Programa Es --->' . " " . $v[$i]->getPrograma() . "</br>";
echo'El Semestre Es --->' . " " . $v[$i]->getSemestre() . "</br>";
echo'El Valor De La Matricula Es --->' . " " . $v[$i]->getValormatri() . "</br>";
echo '</br>';
} else if ($v[$i]instanceof EstudianteEmpleado) {
echo 'ESTUDIANTE & EMPLEADO </br>';
echo'La Cedula Es --->' . " " . $v[$i]->getCedula() . "</br>";
echo'El Nombre Es --->' . " " . $v[$i]->getNombre() . "</br>";
echo'El Apellido Es --->' . " " . $v[$i]->getApellido() . "</br>";
echo'La Edad Es --->' . " " . $v[$i]->getEdad() . "</br>";
echo'El Codigo Es --->' . " " . $v[$i]->getCodigo() . "</br>";
echo'El Programa Es --->' . " " . $v[$i]->getPrograma() . "</br>";
echo'El Cargo Es --->' . " " . $v[$i]->getCargo() . "</br>";
echo'El Semestre Es --->' . " " . $v[$i]->getSemestre() . "</br>";
echo'El Salario Es --->' . " " . $v[$i]->getSalario() . "</br>";
echo'El Codigo de empleado Es --->' . " " . $v[$i]->getCodigoemp() . "</br>";
echo'Su Vinculacion Es --->' . " " . $v[$i]->getVinculacion() . "</br>";
echo'El Valor De La Matricula Es --->' . " " . $v[$i]->getValormatri() . "</br>";
echo '</br>';
if ($v[$i]->getSalario()>= ($v[$i]->getValormatri()*0.25)){
echo 'Si alcanza';
}
else {
echo 'No alcanza ';
}
} else {
echo '</br>';
echo 'Empleado </br>';
echo'La Cedula Es --->' . " " . $v[$i]->getCedula() . "</br>";
echo'EL Nombre Es --->' . " " . $v[$i]->getNombre() . "</br>";
echo'El Apellido Es --->' . " " . $v[$i]->getApellido() . "</br>";
echo'La Edad Es --->' . " " . $v[$i]->getEdad() . "</br>";
echo'El Codigo de empleado Es --->' . " " . $v[$i]->getCodigoemp() . "</br>";
echo'El Cargo Es --->' . " " . $v[$i]->getCargo() . "</br>";
echo'El Salario Es --->' . " " . $v[$i]->getSalario() . "</br>";
echo'Su Vinculacion Es --->' . " " . $v[$i]->getVinculacion() . "</br>";
echo '</br>';
}
}
?>
</body>
</html>
echo 'ESTUDIANTE & EMPLEADO </br>';
...
echo'El Codigo Es --->' . " " . $v[$i]->getCodigo() . "</br>";
echo'El Codigo Es --->' . " " . $v[$i]->getCodigoemp() . "</br>";
echo'El Programa Es --->' . " " . $v[$i]->getPrograma() . "</br>";
echo'El Semestre Es --->' . " " . $v[$i]->getSemestre() . "</br>";
echo'El Valor De La Matricula Es --->' . " " . $v[$i]->getValormatri() . "</br>";
<?php
include_once 'Persona.php';
include_once 'Empleado.php';
include_once 'Estudiante.php';
include_once 'PazySalvo.php';
class EstudianteEmpleado extends Empleado implements PazySalvo {
private $codigo;
private $programa;
private $semestre;
private $valormatri;
function __construct($cedula, $nombre, $apellido, $edad, $codigo, $programa, $cargo, $semestre, $salario, $codigoemp, $vinculacion, $valormatri) {
parent::__construct($cedula, $nombre, $apellido, $edad, $codigoemp, $cargo, $salario, $vinculacion);
$this->codigo = $codigo;
$this->programa = $programa;
$this->semestre = $semestre;
$this->valormatri = $valormatri;
}
public function getPrograma() { return $this->programa; }
public function getSemestre() { return $this->semestre; }
public function getValormatri() {return $this->valormatri; }
public function saldo() { return 'Respuesta del metodo saldo aqui'; }
public function mostrar() { return 'Respuesta del método mostrar'; }
}
?>