0
How I put the method descontoINSS
on that page?
<?php
include_once("Pessoa-class.php");
include_once("PessoaFisica-class.php");
include_once("Funcionario-class.php");
include_once("index.php");
$nome = $_POST['nome'];
$sexo = $_POST['sexo'];
$CPF = $_POST['cpf'];
$salario = $_POST['salario'];
$Funcionario = new Funcionario();
$Funcionario->setNome($nome);
$Funcionario->setSexo($sexo);
$Funcionario->setSalario($salario);
$Funcionario->descontoINSS($x);
echo "O valor de desconto do INSS é R$ $x";
?>
the method is in this class?
<?php
class Funcionario extends Pessoa {
private $salario;
public function getSalario(){
return $this->salario;
}
public function setSalario($salario){
if ($salario<0)
echo "ERRO: Salário não pode ser negativo";
else
$this->salario = $salario;
}
public function descontoINSS($x){
return $x = 0.11*$this->salario;
}
}
?>
Declare a variable that will receive the return of the method
descontoINSS
...$x = $Funcionario->descontoINSS($salario);
– NoobSaibot
I’m voting to close because apparently the user has been removed.
– NoobSaibot
The author of the question has just come and gone?
– Victor Stafusa
@Good victorstafusa had the name Carla, asked the question, edited at the same time I was adjusting the formatting, and then just disappeared.
– NoobSaibot