package Alunos;
public class Main {
static void main(String[] args) {
Aluno aluno1 = new Aluno("Gabriel", "Regular");
Bolsistas aluno2 = new Bolsistas("Julia");
Regulares aluno3 = new Regulares("Ana");
aluno1.indentificar();
aluno2.indentificar();
aluno3.indentificar();
}
}
package Alunos;
public class Aluno {
private String nome;
private String tipo;
public Aluno(String nome, String tipo) {
this.nome = nome;
this.tipo = tipo;
}
void indentificar(){
System.out.println("Aluno: " + nome + " - tipo: " + tipo);
}
}
package Alunos;
public class Regulares extends Aluno {
public Regulares(String nome) {
super(nome, "Regular");
}
}
package Alunos;
public class Bolsistas extends Aluno {
public Bolsistas(String nome) {
super(nome, "bolsista");
}
}