Compare commits
44 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21bd0d7432 | ||
|
|
0b5ff1b326 | ||
|
|
5016c8aef9 | ||
|
|
865323702f | ||
|
|
f4e39f6fae | ||
|
|
2ed1e404b1 | ||
|
|
40e0b63fdb | ||
|
|
26191b776d | ||
|
|
e4328b8828 | ||
|
|
28499648e3 | ||
|
|
2233b51b86 | ||
|
|
6d58b324b7 | ||
|
|
e2ca24a21d | ||
|
|
ea48ef7541 | ||
|
|
e4f0f7e7e9 | ||
|
|
43ba3753f9 | ||
| d19f0ebc4e | |||
|
|
d1f1d43e30 | ||
|
|
6cdb90cf02 | ||
|
|
f462b4bd2f | ||
|
|
7f1b293d70 | ||
|
|
823413293f | ||
|
|
4fa2f47d03 | ||
|
|
0d195e4eb6 | ||
|
|
82a210d72c | ||
|
|
e52e4fd7e1 | ||
|
|
756e5669dd | ||
|
|
e7aaf88337 | ||
|
|
c6ce40a962 | ||
|
|
4be954a333 | ||
|
|
51286b5d8d | ||
|
|
30a86b398e | ||
|
|
342447e9a7 | ||
|
|
c0b1d78e34 | ||
|
|
a77e1a1816 | ||
|
|
68a1209f70 | ||
|
|
85aabf555e | ||
| 0aba824e8c | |||
|
|
fc6233d007 | ||
|
|
cb6cbd2f05 | ||
| fce872ee77 | |||
| 8c452580aa | |||
|
|
8bf55df0ec | ||
| 56ebb9bd6c |
9 changed files with 559 additions and 152 deletions
|
|
@ -7,67 +7,49 @@ public class Acompanhamento {
|
||||||
private int atividadesNaoEstudadas;
|
private int atividadesNaoEstudadas;
|
||||||
private double riscoPedagogico;
|
private double riscoPedagogico;
|
||||||
|
|
||||||
public Acompanhamento(Aluno aluno, int atividadesEntregues, int atividadesIA, int atividadesExplicadas,
|
public Acompanhamento(Aluno aluno, int atividadesEntregues, int atividadesIA, int atividadesExplicadas, int atividadesSemAjuda, int atividadesNaoEstudadas){
|
||||||
int atividadesSemAjuda, int atividadesNaoEstudadas) {
|
|
||||||
this.aluno = aluno;
|
this.aluno = aluno;
|
||||||
this.atividadesEntregues = atividadesEntregues;
|
this.atividadesEntregues = atividadesEntregues;
|
||||||
this.atividadesIA = atividadesIA;
|
this.atividadesIA = atividadesIA;
|
||||||
this.atividadesExplicadas = atividadesExplicadas;
|
this.atividadesExplicadas = atividadesExplicadas;
|
||||||
this.atividadesSemAjuda = atividadesSemAjuda;
|
this.atividadesSemAjuda = atividadesSemAjuda;
|
||||||
this.atividadesNaoEstudadas = atividadesNaoEstudadas;
|
this.atividadesNaoEstudadas = atividadesNaoEstudadas;
|
||||||
|
|
||||||
|
this.riscoPedagogico = this.calcularRisco();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calcularRisco() {
|
private double calcularRisco(){
|
||||||
double razaoIa = atividadesIA / atividadesEntregues;
|
double razaoIa = (double) atividadesIA / (double) atividadesEntregues;
|
||||||
double razaoNaoExplicadas = (atividadesEntregues - atividadesExplicadas) / atividadesEntregues;
|
double razaoNaoExplicadas = (double) (atividadesEntregues - atividadesExplicadas) / (double) atividadesEntregues;
|
||||||
double razaoComAjuda = (atividadesEntregues - atividadesSemAjuda) / atividadesEntregues;
|
double razaoComAjuda = (double) (atividadesEntregues - atividadesSemAjuda) / (double) atividadesEntregues;
|
||||||
double razaoNaoEstudadas = atividadesNaoEstudadas / atividadesEntregues;
|
double razaoNaoEstudadas = (double) atividadesNaoEstudadas / (double) atividadesEntregues;
|
||||||
double media = (razaoIa + razaoNaoExplicadas + razaoComAjuda + razaoNaoEstudadas) / 4;
|
double media = (razaoIa + razaoNaoExplicadas + razaoComAjuda + razaoNaoEstudadas) / (double) 4;
|
||||||
this.riscoPedagogico = media * 10;
|
|
||||||
|
|
||||||
|
return media * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getRiscoPedagogico() {
|
public double getRiscoPedagogico(){
|
||||||
return riscoPedagogico;
|
return this.calcularRisco();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRiscoLabel() {
|
public String getRiscoLabel(){
|
||||||
this.calcularRisco();
|
this.riscoPedagogico = this.calcularRisco();
|
||||||
if (riscoPedagogico < 3.3) {
|
|
||||||
return "BAIXO";
|
if (this.riscoPedagogico <= 3.3){
|
||||||
|
return "O risco pedagogico deste aluno eh BAIXO";
|
||||||
}
|
}
|
||||||
if (riscoPedagogico > 3.3 && riscoPedagogico < 6.6) {
|
if (this.riscoPedagogico > 3.3 && this.riscoPedagogico < 6.6){
|
||||||
return "MODERADO";
|
return "O risco pedagogico deste aluno eh MODERADO";
|
||||||
}
|
}
|
||||||
return "ALTO";
|
if (this.riscoPedagogico >= 6.6){
|
||||||
|
return "O risco pedagogico deste aluno eh ALTO";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Erro.E7;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Aluno getAluno() {
|
public Aluno getAluno(){
|
||||||
return this.aluno;
|
return this.aluno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAluno(Aluno aluno) {
|
}
|
||||||
this.aluno = aluno;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtividadesEntregues(int atividadesEntregues) {
|
|
||||||
this.atividadesEntregues = atividadesEntregues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtividadesIA(int atividadesIA) {
|
|
||||||
this.atividadesIA = atividadesIA;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtividadesExplicadas(int atividadesExplicadas) {
|
|
||||||
this.atividadesExplicadas = atividadesExplicadas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtividadesSemAjuda(int atividadesSemAjuda) {
|
|
||||||
this.atividadesSemAjuda = atividadesSemAjuda;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAtividadesNaoEstudadas(int atividadesNaoEstudadas) {
|
|
||||||
this.atividadesNaoEstudadas = atividadesNaoEstudadas;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@ public class Aluno {
|
||||||
private int ano;
|
private int ano;
|
||||||
private boolean bolsista;
|
private boolean bolsista;
|
||||||
|
|
||||||
public Aluno(int nome, int idade, String localNascimento, String curso, String matricula, int semestre, int ano, boolean bolsista){
|
public Aluno(String nome, int idade, String localNascimento, String curso, String matricula, int semestre, int ano, boolean bolsista){
|
||||||
this.pessoa = new Pessoa(nome, idade, localNascimento);
|
this.pessoa = new Pessoa(nome, idade, localNascimento);
|
||||||
this.curso = curso;
|
this.curso = curso;
|
||||||
this.matricula = matricula;
|
this.matricula = matricula;
|
||||||
|
|
@ -15,7 +15,7 @@ public class Aluno {
|
||||||
this.bolsista = bolsista;
|
this.bolsista = bolsista;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNome(){
|
public String getNome(){
|
||||||
return this.pessoa.getNome();
|
return this.pessoa.getNome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,4 +66,4 @@ public class Aluno {
|
||||||
public void setBolsista(boolean bolsista){
|
public void setBolsista(boolean bolsista){
|
||||||
this.bolsista = bolsista;
|
this.bolsista = bolsista;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
public class Bolsista{
|
public class Bolsista {
|
||||||
private Aluno aluno;
|
private Aluno aluno;
|
||||||
private String projeto;
|
private String projeto;
|
||||||
private String orientador;
|
private String orientador;
|
||||||
|
|
||||||
public Bolsista(int nome, int idade, String localNascimento, String curso, String matricula, int semestre, int ano, boolean bolsista, String projeto, String orientador){
|
public Bolsista(Aluno aluno, String projeto, String orientador){
|
||||||
this.aluno = new Aluno(nome, idade, localNascimento, curso, matricula, semestre, ano, bolsista);
|
this.aluno = aluno;
|
||||||
this.projeto = projeto;
|
this.projeto = projeto;
|
||||||
this.orientador = orientador;
|
this.orientador = orientador;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNome(){
|
public String getNome(){
|
||||||
return this.aluno.getNome();
|
return this.aluno.getNome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,4 +72,4 @@ public class Bolsista{
|
||||||
public void setOrientador(String orientador){
|
public void setOrientador(String orientador){
|
||||||
this.orientador = orientador;
|
this.orientador = orientador;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
297
Dados.java
297
Dados.java
|
|
@ -1,2 +1,299 @@
|
||||||
public class Dados {
|
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 String appendAluno(Aluno aluno){
|
||||||
|
if (checkDuplicate(aluno.getNome())) {return Erro.E3;}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
return "Aluno cadastrado com sucesso.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String appendAcompanhamento(Acompanhamento acomp){
|
||||||
|
int index = findAcompanhamentoIndex(acomp.getAluno().getNome());
|
||||||
|
|
||||||
|
if (index != -1){
|
||||||
|
acompanhamentos[index] = acomp;
|
||||||
|
return "Acompanhamento atualizado com sucesso.";
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
return "Acompanhamento cadastrado com sucesso.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public int findAcompanhamentoIndex(String nome){
|
||||||
|
for (int i = 0; i < acompanhamentos.length; i++){
|
||||||
|
if (nome.equals(acompanhamentos[i].getAluno().getNome()))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String appendBolsista(Bolsista bolsista){
|
||||||
|
int index = findBolsistaIndex(bolsista.getNome());
|
||||||
|
|
||||||
|
if (index != -1){
|
||||||
|
bolsistas[index] = bolsista;
|
||||||
|
return "Bolsista atualizado com sucesso.";
|
||||||
|
}
|
||||||
|
|
||||||
|
int size = this.bolsistas.length;
|
||||||
|
|
||||||
|
Bolsista[] novoArray = new Bolsista[size + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++){
|
||||||
|
novoArray[i] = this.bolsistas[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
novoArray[size] = bolsista;
|
||||||
|
this.bolsistas = novoArray;
|
||||||
|
|
||||||
|
return "Bolsista cadastrado com sucesso.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkDuplicate(String nome){
|
||||||
|
for (int i = 0; i < alunos.length; i++){
|
||||||
|
if (nome.equals(alunos[i].getNome())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int findAlunoIndex(String nome){
|
||||||
|
for (int i = 0; i < alunos.length; i++){
|
||||||
|
if (nome.equals(alunos[i].getNome()))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int findBolsistaIndex(String nome){
|
||||||
|
for (int i = 0; i < bolsistas.length; i++){
|
||||||
|
if (nome.equals(bolsistas[i].getNome()))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Aluno findAluno(String nome){
|
||||||
|
int index = findAlunoIndex(nome);
|
||||||
|
|
||||||
|
if (index == -1) {return null;}
|
||||||
|
else {return alunos[index];}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Acompanhamento findAcompanhamento(String nome){
|
||||||
|
int index = findAcompanhamentoIndex(nome);
|
||||||
|
|
||||||
|
if (index == -1) {return null;}
|
||||||
|
else {return acompanhamentos[index];}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String listAlunos(){
|
||||||
|
if (alunos.length == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
String lista = "";
|
||||||
|
for (int i = 0; i < alunos.length; i++){
|
||||||
|
lista = lista.concat(alunos[i].getNome() + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return lista;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String listBolsistas(){
|
||||||
|
if (bolsistas.length == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
String lista = "";
|
||||||
|
for (int i = 0; i < bolsistas.length; i++){
|
||||||
|
lista = lista.concat(bolsistas[i].getNome());
|
||||||
|
}
|
||||||
|
|
||||||
|
return lista;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String riskReport(){
|
||||||
|
if (acompanhamentos.length == 0) {return Erro.E8;}
|
||||||
|
|
||||||
|
String relatorio = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < acompanhamentos.length; i++){
|
||||||
|
relatorio = relatorio.concat(acompanhamentos[i].getAluno().getNome() + ": ");
|
||||||
|
relatorio = relatorio.concat(acompanhamentos[i].getRiscoLabel() + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return relatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String riskReportHigh(){
|
||||||
|
if (acompanhamentos.length == 0) {return Erro.E8;}
|
||||||
|
|
||||||
|
String relatorio = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < acompanhamentos.length; i++){
|
||||||
|
if (acompanhamentos[i].getRiscoPedagogico() >= 6.6){
|
||||||
|
relatorio = relatorio.concat(acompanhamentos[i].getAluno().getNome() + ": Risco ALTO\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (relatorio.length() == 0) {return Erro.E9;}
|
||||||
|
|
||||||
|
return relatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String maiorNome(){
|
||||||
|
if (alunos.length == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
if (alunos.length == 1) {return alunos[0].getNome();}
|
||||||
|
|
||||||
|
int k = 0;
|
||||||
|
for (int i = 1; i < alunos.length; i++){
|
||||||
|
if (alunos[i].getNome().length() > alunos[k].getNome().length())
|
||||||
|
k = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return alunos[k].getNome();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String averageAge(){
|
||||||
|
if (alunos.length == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
double sum = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < alunos.length; i++){
|
||||||
|
sum += alunos[i].getIdade();
|
||||||
|
}
|
||||||
|
|
||||||
|
sum = sum / alunos.length;
|
||||||
|
return "Idade media dos alunos: " + sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String totalVowels(){
|
||||||
|
if (alunos.length == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
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 "Numero total de vogais:" + sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isVowel(char a){
|
||||||
|
return (a == 'a') || (a == 'e') || (a == 'i') || (a == 'o') || (a == 'u')
|
||||||
|
|| (a == 'A') || (a == 'E') || (a == 'I') || (a == 'O') || (a == 'U');
|
||||||
|
}
|
||||||
|
|
||||||
|
public void makeChamada(){
|
||||||
|
this.chamada = "";
|
||||||
|
|
||||||
|
if (alunos.length == 0) {return;}
|
||||||
|
|
||||||
|
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 String printChamada(){
|
||||||
|
if (chamada.length() == 0) {return Erro.E6;}
|
||||||
|
|
||||||
|
return chamada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChamada(){
|
||||||
|
return chamada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double coursePercent(String curso){
|
||||||
|
if (alunos.length == 0) {return -1;}
|
||||||
|
|
||||||
|
double num = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < alunos.length; i++){
|
||||||
|
if (alunos[i].getCurso().equals(curso))
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (num / alunos.length) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String rankingRisco(){
|
||||||
|
if (acompanhamentos.length == 0) {return Erro.E8;}
|
||||||
|
|
||||||
|
int size = acompanhamentos.length;
|
||||||
|
Acompanhamento[] sorted = new Acompanhamento[size];
|
||||||
|
double sum = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++){
|
||||||
|
sorted[i] = acompanhamentos[i];
|
||||||
|
sum += sorted[i].getRiscoPedagogico();
|
||||||
|
}
|
||||||
|
|
||||||
|
Acompanhamento aux;
|
||||||
|
|
||||||
|
while (true){
|
||||||
|
boolean c = false;
|
||||||
|
|
||||||
|
for (int i = 0; i+1 < size; i++){
|
||||||
|
if (sorted[i].getRiscoPedagogico() < sorted[i+1].getRiscoPedagogico()){
|
||||||
|
aux = sorted[i];
|
||||||
|
sorted[i] = sorted[i+1];
|
||||||
|
sorted[i+1] = aux;
|
||||||
|
c = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c){break;}
|
||||||
|
}
|
||||||
|
|
||||||
|
String ranking = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++){
|
||||||
|
ranking += "Aluno: " + sorted[i].getAluno().getNome() + ". " + sorted[i].getRiscoLabel() + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
ranking += "\nA media de risco eh: " + sum/size;
|
||||||
|
return ranking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
Erro.java
Normal file
14
Erro.java
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
public class Erro {
|
||||||
|
public static final String E0 = "Erro: Um erro inesperado ocorreu: ";
|
||||||
|
public static final String E1 = "Erro: Opcao do menu invalida.";
|
||||||
|
public static final String E2 = "Erro: Aluno nao encontrado.";
|
||||||
|
public static final String E3 = "Erro: Ja existe um aluno com esse nome.";
|
||||||
|
public static final String E4 = "Erro: Voce inseriu numeros invalidos de atividades.";
|
||||||
|
public static final String E5 = "Erro: Nao existem alunos cadastrados.";
|
||||||
|
public static final String E6 = "Erro: Nenhuma chamada foi criada.";
|
||||||
|
public static final String E7 = "Erro: Nao foi possivel calcular o risco pedagogico.";
|
||||||
|
public static final String E8 = "Erro: Nao existem acompanhamentos cadastrados.";
|
||||||
|
public static final String E9 = "Erro: Nao existe nenhum aluno com risco alto.";
|
||||||
|
public static final String E10 = "Erro: Acompanhamento nao encontrado.";
|
||||||
|
public static final String E11 = "Errro: Voce inseriu um dado invalido.";
|
||||||
|
}
|
||||||
216
Gerenciador.java
216
Gerenciador.java
|
|
@ -1,63 +1,197 @@
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Gerenciador {
|
public class Gerenciador {
|
||||||
private Dados dados;
|
private Dados dados;
|
||||||
|
private static Scanner input = new Scanner(System.in);
|
||||||
|
|
||||||
public Gerenciador(Dados dados) {
|
public Gerenciador(Dados dados) {
|
||||||
this.dados = dados;
|
this.dados = dados;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cadastrarAluno() {
|
public String cadastrarAluno() {
|
||||||
|
String nome = "", local = "", curso = "", matricula = "";
|
||||||
|
int idade = 0, semestre = 0, ano = 0;
|
||||||
|
|
||||||
|
while (nome.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o nome do aluno:");
|
||||||
|
nome = input.nextLine();}
|
||||||
|
|
||||||
|
while (local.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o local de nascimento do aluno:");
|
||||||
|
local = input.nextLine();}
|
||||||
|
|
||||||
|
while (curso.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o curso do aluno:");
|
||||||
|
curso = input.nextLine();}
|
||||||
|
|
||||||
|
while (matricula.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira a matricula do aluno:");
|
||||||
|
matricula = input.nextLine();}
|
||||||
|
|
||||||
|
while (idade == 0 ){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira a idade do aluno:");
|
||||||
|
idade = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (idade < 0) {return Erro.E11;}}
|
||||||
|
|
||||||
|
while (semestre == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o semestre do aluno:");
|
||||||
|
semestre = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (semestre < 0) {return Erro.E11;}}
|
||||||
|
|
||||||
|
while (ano == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o ano do aluno:");
|
||||||
|
ano = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (ano < 0) {return Erro.E11;}}
|
||||||
|
|
||||||
|
Aluno aluno = new Aluno(nome, idade, local, curso, matricula, semestre, ano, false);
|
||||||
|
String msg = this.dados.appendAluno(aluno);
|
||||||
|
|
||||||
|
System.out.println("O aluno eh bolsista? (s/n)");
|
||||||
|
String resposta = input.nextLine().toLowerCase();
|
||||||
|
|
||||||
|
if (resposta.equals("s")){
|
||||||
|
return cadastrarBolsista(true, aluno);
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String cadastrarBolsista(boolean resposta, Aluno alunoparametro) {
|
||||||
|
String projeto = "", orientador = "";
|
||||||
|
Aluno aluno;
|
||||||
|
|
||||||
|
if (resposta){
|
||||||
|
aluno = alunoparametro;
|
||||||
|
} else {
|
||||||
|
System.out.println("Insira o nome do aluno a quem voce deseja cadastrar uma bolsa:");
|
||||||
|
aluno = this.dados.findAluno(input.nextLine());
|
||||||
|
|
||||||
|
if (aluno == null) {return Erro.E2;}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (projeto.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o nome do projeto:");
|
||||||
|
projeto = input.nextLine();}
|
||||||
|
|
||||||
|
while (orientador.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira o nome do orientador:");
|
||||||
|
orientador = input.nextLine();}
|
||||||
|
|
||||||
|
Bolsista bolsista = new Bolsista(aluno, projeto, orientador);
|
||||||
|
aluno.setBolsista(true);
|
||||||
|
|
||||||
|
return this.dados.appendBolsista(bolsista);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String registrarAcompanhamento() {
|
||||||
|
System.out.println("Insira o nome do Aluno que voce deseja registrar o acompanhamento:");
|
||||||
|
String nome = input.nextLine();
|
||||||
|
Aluno aluno = this.dados.findAluno(nome);
|
||||||
|
|
||||||
|
if (aluno == null) {return Erro.E2;}
|
||||||
|
|
||||||
|
System.out.println("Insira a quantidade de atividades entregues:");
|
||||||
|
int entregues = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (entregues < 0) {return Erro.E11;}
|
||||||
|
|
||||||
|
System.out.println("Insira a quantidade de atividades entregues nas quais foi declarado o uso de IA:");
|
||||||
|
int ia = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (ia < 0) {return Erro.E11;}
|
||||||
|
|
||||||
|
System.out.println("Insira a quantidade de atividades entregues que o aluno soube explicar:");
|
||||||
|
int explicadas = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (explicadas < 0) {return Erro.E11;}
|
||||||
|
|
||||||
|
System.out.println("Insira a quantidade de atividades entregues que foram feitas sem ajuda:");
|
||||||
|
int semajuda = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (semajuda < 0) {return Erro.E11;}
|
||||||
|
|
||||||
|
System.out.println("Insira a quantidade de atividades entregues que utilizaram estruturas não estudadas:");
|
||||||
|
int naoestudadas = input.nextInt();
|
||||||
|
input.nextLine(); //buffer clear
|
||||||
|
if (naoestudadas < 0) {return Erro.E11;}
|
||||||
|
|
||||||
|
if (ia > entregues || explicadas > entregues || semajuda > entregues || naoestudadas > entregues){
|
||||||
|
return Erro.E4;
|
||||||
|
}
|
||||||
|
|
||||||
|
Acompanhamento acomp = new Acompanhamento(aluno, entregues, ia, explicadas, semajuda, naoestudadas);
|
||||||
|
|
||||||
|
return this.dados.appendAcompanhamento(acomp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String listarAlunos() {
|
||||||
|
return this.dados.listAlunos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String listarBolsistas() {
|
||||||
|
return this.dados.listBolsistas();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String maiorNome(){
|
||||||
|
return this.dados.maiorNome();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String vogaisNomes(){
|
||||||
|
return this.dados.totalVowels();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String percentualAlunos() {
|
||||||
|
String curso = "";
|
||||||
|
|
||||||
|
while (curso.length() == 0){// Repete a pergunta até que uma resposta seja digitada
|
||||||
|
System.out.println("Insira um curso:");
|
||||||
|
curso = input.nextLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
double porcentagem = this.dados.coursePercent(curso);
|
||||||
|
if (porcentagem == -1) {return Erro.E5;}
|
||||||
|
|
||||||
|
return "O percentual de alunos matriculados nesse curso eh de: " + porcentagem + "%";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cadastrarBolsista() {
|
public String mediaIdadeAlunos() {
|
||||||
|
return this.dados.averageAge();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registrarAcompanhamento() {
|
public String criarChamada() {
|
||||||
|
this.dados.makeChamada();
|
||||||
|
|
||||||
|
if (this.dados.getChamada().length() == 0) {return Erro.E5;}
|
||||||
|
|
||||||
|
return "Chamada criada com sucesso.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void listarAlunos() {
|
public String chamada() {
|
||||||
|
return this.dados.printChamada();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void listarBolsistas() {
|
public String calcularRisco() {
|
||||||
|
System.out.println("Insira o nome de um aluno:");
|
||||||
|
Acompanhamento acomp = this.dados.findAcompanhamento(input.nextLine());
|
||||||
|
|
||||||
|
if (acomp == null) {return Erro.E10;}
|
||||||
|
|
||||||
|
return acomp.getRiscoLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void maiorNome() {
|
public String relatorioRisco() {
|
||||||
|
return this.dados.riskReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void vogaisNomes() {
|
public String altoRisco() {
|
||||||
|
return this.dados.riskReportHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void percentualAlunos() {
|
public String inovacao() {
|
||||||
|
return dados.rankingRisco();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void mediaIdadeAlunos() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void criarChamada() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void chamada() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void calcularRisco() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void relatorioRisco() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void altoRisco() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inovacao() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
86
Menu.java
86
Menu.java
|
|
@ -1,24 +1,24 @@
|
||||||
// TODO: implementar os métodos na gerenciadore Gerenciador
|
|
||||||
// TODO: implementar os métodos na gerenciadore Dados
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Menu {
|
public class Menu {
|
||||||
|
|
||||||
private static Dados dados;
|
private static Dados dados;
|
||||||
private static Gerenciador gerenciador;
|
private static Gerenciador gerenciador;
|
||||||
|
private static Scanner input;
|
||||||
|
private static String result;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
dados = new Dados();
|
dados = new Dados();
|
||||||
gerenciador = new Gerenciador(dados);
|
gerenciador = new Gerenciador(dados);
|
||||||
|
input = new Scanner(System.in);
|
||||||
|
result = "";
|
||||||
|
|
||||||
Scanner input = new Scanner(System.in);
|
|
||||||
while (true) {
|
while (true) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Escolha uma opcao:" + "\n" +
|
"\fEscolha uma opcao:" + "\n" +
|
||||||
"1 - Cadastro de Aluno" + "\n" +
|
"1 - Cadastro de Aluno" + "\n" +
|
||||||
"2 - Cadastro de Bolsisa " + "\n" +
|
"2 - Cadastro de Bolsista " + "\n" +
|
||||||
"3 - Regisrar dados de acompanhamento" + "\n" +
|
"3 - Registrar dados de acompanhamento" + "\n" +
|
||||||
"4 - Listar alunos" + "\n" +
|
"4 - Listar alunos" + "\n" +
|
||||||
"5 - Listar alunos bolsistas" + "\n" +
|
"5 - Listar alunos bolsistas" + "\n" +
|
||||||
"6 - Nome mais longo de alunos cadastrados" + "\n" +
|
"6 - Nome mais longo de alunos cadastrados" + "\n" +
|
||||||
|
|
@ -30,71 +30,55 @@ public class Menu {
|
||||||
"12 - Calcular nivel de risco pedagogico" + "\n" +
|
"12 - Calcular nivel de risco pedagogico" + "\n" +
|
||||||
"13 - Relatorio geral de risco pedagogico" + "\n" +
|
"13 - Relatorio geral de risco pedagogico" + "\n" +
|
||||||
"14 - Alunos em alto risco" + "\n" +
|
"14 - Alunos em alto risco" + "\n" +
|
||||||
"15 - (Colocar inovacao aqui)" + "\n" +
|
"15 - Ranking e media de risco" + "\n" +
|
||||||
"16 - Encerrar o programa");
|
"16 - Encerrar o programa\n\n" +
|
||||||
prompt(input.nextInt());
|
|
||||||
|
result);
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = prompt(input.nextInt());
|
||||||
|
} catch(Exception e) {
|
||||||
|
result = Erro.E0 + e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void prompt(int option) {
|
public static String prompt(int option) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
|
|
||||||
// passar parametros
|
|
||||||
|
|
||||||
// String nome,int idade,String local, String curso, String matricula,int
|
|
||||||
// semestre,int ano ,bool bolsista, String projeto, String orientador
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
gerenciador.cadastrarAluno(); // completar com o nome correto das gerenciadores
|
return gerenciador.cadastrarAluno();
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
gerenciador.cadastrarBolsista();
|
return gerenciador.cadastrarBolsista(false, null);
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
gerenciador.registrarAcompanhamento();
|
return gerenciador.registrarAcompanhamento();
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
gerenciador.listarAlunos();
|
return gerenciador.listarAlunos();
|
||||||
break;
|
|
||||||
case 5:
|
case 5:
|
||||||
gerenciador.listarBolsistas();
|
return gerenciador.listarBolsistas();
|
||||||
break;
|
|
||||||
case 6:
|
case 6:
|
||||||
gerenciador.maiorNome();
|
return gerenciador.maiorNome();
|
||||||
break;
|
|
||||||
case 7:
|
case 7:
|
||||||
gerenciador.vogaisNomes();
|
return gerenciador.vogaisNomes();
|
||||||
break;
|
|
||||||
case 8:
|
case 8:
|
||||||
gerenciador.percentualAlunos();
|
return gerenciador.percentualAlunos();
|
||||||
break;
|
|
||||||
case 9:
|
case 9:
|
||||||
gerenciador.mediaIdadeAlunos();
|
return gerenciador.mediaIdadeAlunos();
|
||||||
break;
|
|
||||||
case 10:
|
case 10:
|
||||||
gerenciador.criarChamada();
|
return gerenciador.criarChamada();
|
||||||
break;
|
|
||||||
case 11:
|
case 11:
|
||||||
gerenciador.chamada();
|
return gerenciador.chamada();
|
||||||
break;
|
|
||||||
case 12:
|
case 12:
|
||||||
gerenciador.calcularRisco();
|
return gerenciador.calcularRisco();
|
||||||
break;
|
|
||||||
case 13:
|
case 13:
|
||||||
gerenciador.relatorioRisco();
|
return gerenciador.relatorioRisco();
|
||||||
break;
|
|
||||||
case 14:
|
case 14:
|
||||||
gerenciador.altoRisco();
|
return gerenciador.altoRisco();
|
||||||
break;
|
|
||||||
// TODO: IMPLEMENTAR INOVAÇÃO
|
|
||||||
case 15:
|
case 15:
|
||||||
gerenciador.inovacao();
|
return gerenciador.inovacao();
|
||||||
break;
|
|
||||||
case 16:
|
case 16:
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
System.out.println("Opção inválida");
|
return Erro.E1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
public class Pessoa{
|
public class Pessoa {
|
||||||
private int nome;
|
private String nome;
|
||||||
private int idade;
|
private int idade;
|
||||||
private String localNascimento;
|
private String localNascimento;
|
||||||
|
|
||||||
public Pessoa(int nome, int idade, String localNascimento){
|
public Pessoa(String nome, int idade, String localNascimento){
|
||||||
this.nome = nome;
|
this.nome = nome;
|
||||||
this.idade = idade;
|
this.idade = idade;
|
||||||
this.localNascimento = localNascimento;
|
this.localNascimento = localNascimento;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNome(){
|
public String getNome(){
|
||||||
return this.nome;
|
return this.nome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,5 +20,4 @@ public class Pessoa{
|
||||||
public String getLocal(){
|
public String getLocal(){
|
||||||
return this.localNascimento;
|
return this.localNascimento;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
# Trabalho final de fundamentos
|
|
||||||
|
|
||||||
Inserir aqui o readme do projeto depois
|
|
||||||
Loading…
Reference in a new issue