I'm studying object-oriented Java programming and need to do the following exercise:
Implement class Funcionario
and class Gerente
.
Assistente
, which is also a Funcionario
, and which has a number of
(% method). Override the GET
method. exibeDados()
and Tecnico
classes. I created the following code:
public class Funcionario {
String nome;
String cpf;
double salario;
int matricula;
public void exibeDados(){
System.out.println("Nome: " + nome + " Cpf: " + cpf + " Salário: " + salario + " Matricula: " + matricula);
}
}
public class Gerente extends Funcionario {
String departamento;
}
public class Assistente extends Funcionario{
public void getMatricula(int matricula){
this.matricula = matricula;
}
public void exibeDados(){
System.out.println("Nome: " + nome + " Cpf: " + cpf + " Salário: " + salario + " Matricula: " + this.matricula);
}
}
public class Administrativo extends Assistente {
String turno;
public void adicionalNoturno(double adicional){
if(turno == "noturno" || turno == "Noturno"){
this.salario = this.salario+adicional;
}
}
}
public class Tecnico extends Assistente {
public double bonusSalarial(){
this.salario = this.salario+(this.salario*0.1);
return this.salario;
}
}
There is some error in the construction of methods and inheritance or some error in general taking into account the statement of the exercise.?