diff --git a/Acompanhamento.java b/Acompanhamento.java index 9d36787..78eaa36 100644 --- a/Acompanhamento.java +++ b/Acompanhamento.java @@ -28,6 +28,7 @@ public class Acompanhamento { } public double getRiscoPedagogico() { + this.calcularRisco(); return riscoPedagogico; } diff --git a/Bolsista.java b/Bolsista.java index 26f5048..80b4af4 100644 --- a/Bolsista.java +++ b/Bolsista.java @@ -3,8 +3,8 @@ public class Bolsista{ private String projeto; private String orientador; - public Bolsista(String nome, int idade, String localNascimento, String curso, String matricula, int semestre, int ano, boolean bolsista, String projeto, String orientador){ - this.aluno = new Aluno(nome, idade, localNascimento, curso, matricula, semestre, ano, bolsista); + public Bolsista(Aluno aluno, String projeto, String orientador){ + this.aluno = aluno; this.projeto = projeto; this.orientador = orientador; } @@ -72,4 +72,4 @@ public class Bolsista{ public void setOrientador(String orientador){ this.orientador = orientador; } -} \ No newline at end of file +} diff --git a/Dados.java b/Dados.java index c9b48a2..5efc3d9 100644 --- a/Dados.java +++ b/Dados.java @@ -1,2 +1,173 @@ public class Dados { + private Aluno[] alunos; + private String chamada; + private Acompanhamento[] acompanhamentos; + private Bolsista[] bolsistas; + + public Dados(){ + alunos = new Aluno[]{}; + chamada = ""; + acompanhamentos = new Acompanhamento[]{}; + bolsistas = new Bolsista[]{}; + } + + public void appendAluno(Aluno aluno){ + int size = this.alunos.length; + + Aluno[] novoArray = new Aluno[size + 1]; + + for (int i = 0; i < size; i++){ + novoArray[i] = this.alunos[i]; + } + + novoArray[size] = aluno; + this.alunos = novoArray; + } + + public void appendAcompanhamento(Acompanhamento acomp){ + int size = this.acompanhamentos.length; + + Acompanhamento[] novoArray = new Acompanhamento[size + 1]; + + for (int i = 0; i < size; i++){ + novoArray[i] = this.acompanhamentos[i]; + } + + novoArray[size] = acomp; + this.acompanhamentos = novoArray; + } + + public void appendBolsista(Bolsista bolsista){ + + + + } + + private int findAlunoIndex(String nome){ + for (int i = 0; i < alunos.length; i++){ + if (nome.equals(alunos[i].getNome())) + return i; + } + return -1; + } + + public Aluno findAluno(String nome){ + return alunos[findAlunoIndex(nome)]; + } + + public Acompanhamento findAcompanhamento(String nome){ + for (int i = 0; i < acompanhamentos.length; i++){ + if (acompanhamentos[i].getAluno().getNome().equals(nome)) { + return acompanhamentos[i]; + } + } + + return null; + } + + public void listAlunos(){ + for (int i = 0; i < alunos.length; i++){ + System.out.println(alunos[i].getNome()); + } + } + + public void listBolsistas(){ + for (int i = 0; i < alunos.length; i++){ + if (alunos[i].getBolsista()) + System.out.println(alunos[i].getNome()); + } + } + + public void riskReport(){ + + String relatorio = ""; + + for (int i = 0; i < acompanhamentos.length; i++){ + relatorio = relatorio.concat(acompanhamentos[i].getAluno().getNome() + ": Risco "); + relatorio = relatorio.concat(acompanhamentos[i].getRiscoLabel() + "\n"); + } + + System.out.println(relatorio); + + } + + public void riskReportHigh(){ + + String relatorio = ""; + + for (int i = 0; i < acompanhamentos.length; i++){ + if (acompanhamentos[i].getRiscoLabel().equals("ALTO")){ + relatorio = relatorio.concat(acompanhamentos[i].getAluno().getNome() + ": Risco ALTO\n"); + } + } + + System.out.println(relatorio); + } + + public void maiorNome(){ + int k = 0; + for (int i = 1; i < alunos.length; i++){ + if (alunos[i].getNome().length() > alunos[k].getNome().length()) + k = i; + } + System.out.println(alunos[k].getNome()); + } + + public double averageAge(){ + double sum = 0; + + for (int i = 0; i < alunos.length; i++){ + sum += alunos[i].getIdade(); + } + + sum = sum / alunos.length; + return sum; + } + + public int totalVowels(){ + + int sum = 0; + + for (int k = 0; k < alunos.length; k++){ + String nome = alunos[k].getNome(); + + for (int j = 0; j < nome.length(); j++){ + if (isVowel(nome.charAt(j))){ + sum++;} + } + } + + + return sum; + } + + private boolean isVowel(char a){ + + return (a == 'a') || (a == 'e') || (a == 'i') || (a == 'o') || (a == 'u'); + + } + + public void makeChamada(){ + this.chamada = ""; + for (int i = 0; i < alunos.length; i++){ + this.chamada = this.chamada.concat(alunos[i].getMatricula() + " / "); + this.chamada = this.chamada.concat(alunos[i].getNome() + " / "); + this.chamada = this.chamada.concat(alunos[i].getCurso() + "\n"); + } + } + + public void printChamada(){ + System.out.println(chamada); + } + + public double coursePercent(String curso){ + double num = 0; + + for (int i = 0; i < alunos.length; i++){ + if (alunos[i].getCurso().equals(curso)) + num++; + } + + return (num / alunos.length) * 100; + } } diff --git a/Gerenciador.java b/Gerenciador.java index 76612c8..26c280d 100644 --- a/Gerenciador.java +++ b/Gerenciador.java @@ -1,3 +1,7 @@ +// TODO: validação nos metodos com entrada + +import java.util.Scanner; + public class Gerenciador { private Dados dados; @@ -7,13 +11,72 @@ public class Gerenciador { public void cadastrarAluno() { + System.out.println("Insira o ano do aluno:"); + ano = input.nextInt(); + + Aluno aluno = new Aluno(nome, idade, local, curso, matricula, semestre, ano, false); + this.dados.appendAluno(aluno); + + System.out.println("O aluno é bolsista? (s/n)"); + String resposta = input.nextLine().toLowerCase(); + if (resposta.equals("s")){ + cadastrarBolsista(true, aluno); + } + } - public void cadastrarBolsista() { + public void cadastrarBolsista(boolean resposta, Aluno alunoparametro) { + + Aluno aluno; + + if (resposta){ + aluno = alunoparametro; + } else { + System.out.println("Insira o nome do aluno a quem você deseja cadastrar uma bolsa:"); + aluno = this.dados.findAluno(input.nextLine()); + } + + System.out.println("Insira o nome do projeto:"); + String projeto = input.nextLine(); + + System.out.println("Insira o nome do orientador:"); + String orientador = input.nextLine(); + + Bolsista bolsista = new Bolsista(aluno, projeto, orientador); + aluno.setBolsista(true); + this.dados.appendBolsista(bolsista); } public void registrarAcompanhamento() { + System.out.println("Insira o nome do Aluno que você deseja registrar o acompanhamento:"); + String nome = input.nextLine(); + Aluno aluno = this.dados.findAluno(nome); + + Acompanhamento acomp = new Acompanhamento(aluno, 0, 0, 0, 0, 0); + + System.out.println("Insira a quantidade de atividades entregues:"); + int entregues = input.nextInt(); + acomp.setAtividadesEntregues(entregues); + + System.out.println("Insira a quantidade de atividades entregues nas quais foi declarado o uso de IA:"); + int ia = input.nextInt(); + acomp.setAtividadesIA(ia); + + System.out.println("Insira a quantidade de atividades entregues que o aluno soube explicar:"); + int explicadas = input.nextInt(); + acomp.setAtividadesExplicadas(explicadas); + + System.out.println("Insira a quantidade de atividades entregues que foram feitas sem ajuda:"); + int semajuda = input.nextInt(); + acomp.setAtividadesSemAjuda(semajuda); + + System.out.println("Insira a quanntidade de atividades entregues que utilizarão estruturas não estudadas:"); + int naoestudadas = input.nextInt(); + acomp.setAtividadesNaoEstudadas(naoestudadas); + + this.dados.appendAcompanhamento(acomp); + } public void listarAlunos() { @@ -33,6 +96,11 @@ public class Gerenciador { public void percentualAlunos() { + System.out.println("Insira um curso:"); + String curso = input.nextLine(); + + System.out.print("O percentual de alunos matriculados nesse curso é de: " + this.dados.coursePercent(curso) + "%\n"); + } public void mediaIdadeAlunos() { @@ -47,14 +115,22 @@ public class Gerenciador { } public void calcularRisco() { + + System.out.println("Insira o nome de um aluno:"); + Acompanhamento acomp = this.dados.findAcompanhamento(input.nextLine()); + + System.out.println("O risco pedagógico deste aluno é " + acomp.getRiscoLabel()); + } public void relatorioRisco() { + this.dados.riskReport(); + } public void altoRisco() { - + this.dados.riskReportHigh(); } public void inovacao() { diff --git a/Menu.java b/Menu.java index 41fd49f..77a0df6 100644 --- a/Menu.java +++ b/Menu.java @@ -1,5 +1,4 @@ -// TODO: implementar os métodos na gerenciadore Gerenciador -// TODO: implementar os métodos na gerenciadore Dados +// TODO: atualizar README.md import java.util.Scanner; @@ -48,7 +47,7 @@ public class Menu { gerenciador.cadastrarAluno(); // completar com o nome correto das gerenciadores break; case 2: - gerenciador.cadastrarBolsista(); + gerenciador.cadastrarBolsista(false, null); break; case 3: gerenciador.registrarAcompanhamento();