Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
137 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
public class MonitorDeDisciplina extends Aluno { | ||
|
||
public static final float CRA_MINIMO_PARA_RENOVACAO_MONITORIA = 6.0f; | ||
|
||
private Disciplina disciplina; | ||
|
||
public MonitorDeDisciplina() { | ||
super(); | ||
} | ||
|
||
public MonitorDeDisciplina(long dre, String nome, Disciplina disciplina) { | ||
super(dre, nome); | ||
this.disciplina = disciplina; | ||
} | ||
|
||
public void verificarNotas() { | ||
// ToDo ... | ||
} | ||
|
||
public void renovarMonitoria() { | ||
if (this.getCra() >= CRA_MINIMO_PARA_RENOVACAO_MONITORIA) { | ||
// ToDo ... | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MonitorDeDisciplina{" + | ||
"disciplina=" + disciplina + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public String getHistoricoParaImpressao() { | ||
String resultado = "HISTÓRICO DE MONITOR!!!!!!!!\n" + | ||
super.getHistoricoParaImpressao(); | ||
return resultado; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,52 @@ | ||
import java.util.Calendar; | ||
|
||
public class Siguinha { | ||
|
||
public final static float MEDIA_MINIMA_PARA_APROVACAO = 5.0f; | ||
|
||
private static Periodo periodoCorrente = null; | ||
|
||
// apenas para escrever testes rápidos, por ora | ||
public static void main(String[] args) { | ||
String instituicaoDeEnsino; | ||
|
||
public static int obterAnoCorrente() { | ||
return Calendar.getInstance().get(Calendar.YEAR); | ||
} | ||
|
||
Aluno joao = new Aluno(1111, new String("João")); | ||
Aluno maria = new Aluno(2222, "Maria"); | ||
private static int obterSemestreCorrente() { | ||
return obterMesCorrente() <= 6 ? 1 : 2; | ||
} | ||
|
||
System.out.println("joao == maria? " + (joao == maria)); | ||
System.out.println("joao == joao? " + (joao == joao)); | ||
public static int obterMesCorrente() { | ||
return Calendar.getInstance().get(Calendar.MONTH); | ||
} | ||
|
||
System.out.println("joao.equals(maria)? " + joao.equals(maria)); | ||
System.out.println("joao.equals(joao)? " + joao.equals(joao)); | ||
public static Periodo obterPeriodoCorrente() { | ||
|
||
Aluno outroObjetoRepresentandoJoao = new Aluno(1111, new String("João")); | ||
if (periodoCorrente != null) { | ||
if (periodoCorrente.getAno() != obterAnoCorrente() || | ||
periodoCorrente.getSemestre() != obterSemestreCorrente()) { | ||
periodoCorrente = null; // invalida o cache | ||
} | ||
} | ||
|
||
System.out.println("joao == outroObjetoRepresentandoJoao? " + | ||
(joao == outroObjetoRepresentandoJoao)); | ||
if (periodoCorrente == null) { // verifica o memo ("cache") | ||
// atualiza o cache | ||
periodoCorrente = new Periodo(obterAnoCorrente(), obterSemestreCorrente()); | ||
} | ||
|
||
System.out.println("joao.equals(outroObjetoRepresentandoJoao)? " + | ||
(joao.equals(outroObjetoRepresentandoJoao))); | ||
return periodoCorrente; | ||
} | ||
|
||
// Aluno joao2 = new Aluno(1111, "João"); | ||
Aluno joao2; | ||
joao2 = joao; | ||
// apenas para escrever testes rápidos, por ora | ||
public static void main(String[] args) { | ||
|
||
System.out.println("joao2 == joao? " + | ||
(joao2 == joao)); | ||
System.out.println("joao2.equals(joao)? " + | ||
(joao2.equals(joao))); | ||
System.out.println("Ano corrente = " + obterPeriodoCorrente()); | ||
|
||
Disciplina calculo1 = new Disciplina("Cálculo 1", 6, "MAA323"); | ||
|
||
MonitorDeDisciplina fulano; | ||
fulano = new MonitorDeDisciplina();//1234, "Fulano de Tal", calculo1); | ||
|
||
System.out.println("Aluno: " + fulano); // fulano.toString() será chamado automaticamente | ||
} | ||
} |