Falta pouco!

0 dias

0 horas

0 min

0 seg

0
respostas

Sugestão do exercico

package entities;

public class Alunos {

protected String nome;
protected String tipo;


public Alunos(String nome, String tipo) {
    this.nome = nome;
    this.tipo = tipo;
}

public String getTipo() {
    return tipo;
}

public void setTipo(String tipo) {
    this.tipo = tipo;
}

public String getNome() {
    return nome;
}

public void setNome(String nome) {
    this.nome = nome;
}

public void identificar(){

    System.out.printf("\nAluno: "+ nome +" - tipo: " + tipo);
}

}

package entities;

public class Bolsista extends Alunos{


    public Bolsista(String nome) {
        super(nome, "bolsista");
    }
}

package br.com.salesplatform;

import entities.Alunos;
import entities.Bolsista;

//TIP To Run code, press or
// click the icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
Alunos aluno1 = new Alunos("Fernando","Regular");
Bolsista aluno2 = new Bolsista("Lucas");

aluno1.identificar();
aluno2.identificar();

}
}