Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package matheusediogo;
- import java.util.Scanner;
- public class MatheusEDiogo {
- public static void main(String[] args) {
- int docente = 0;
- int aluno = 0;
- String cpf;
- String verificaCpf;
- int contadorCpf;
- int escolha = 1;
- int titulo = 0;
- int tipo = 0;
- int curso = 0;
- int reingresso = 0;
- Scanner ler = new Scanner(System.in);
- Aluno[] a = new Aluno[30];
- Docente[] d = new Docente[30];
- while (escolha != 0){
- System.out.println("1.Cadastrar Docente\n2.Cadastrar Aluno\n3.Mostrar os Dados do Docente\n4.Mostrar os Dados do Aluno\n5.Listar Docentes Efetivos ou Temporários\n6.Listar Docentes de uma Titulação\n7.Listar Alunos de um Curso\n8.Listar alunos Reingressantes\n0.Sair\n");
- escolha = ler.nextInt();
- switch(escolha){
- case 1:
- ler.nextLine();
- System.out.println("Digite o cpf: ");
- cpf = ler.nextLine();
- for(contadorCpf = 0; contadorCpf < docente; contadorCpf++){
- verificaCpf = d[docente].getCpf();
- if(cpf.equals(verificaCpf)){
- contadorCpf = 99;
- }
- }
- if(contadorCpf == 100){
- System.out.println("Cpf inválido");
- System.out.println("");
- }
- else{
- for(contadorCpf = 0; contadorCpf < aluno; contadorCpf++){
- verificaCpf = a[contadorCpf].getCpf();
- if(cpf.equals(verificaCpf)){
- contadorCpf = 99;
- }
- }
- if(contadorCpf == 100){
- System.out.println("Cpf inválido");
- System.out.println("");
- }
- else{
- d[docente] = new Docente();
- d[docente].cadastrarDocente(docente, cpf);
- docente++;
- }
- }
- break;
- case 2:
- ler.nextLine();
- System.out.println("Digite o cpf: ");
- cpf = ler.nextLine();
- for(contadorCpf = 0; contadorCpf < aluno; contadorCpf++){
- verificaCpf = a[contadorCpf].getCpf();
- if(cpf.equals(verificaCpf)){
- contadorCpf = 99;
- }
- }
- if(contadorCpf == 100){
- System.out.println("Cpf inválido");
- }
- else{
- for(contadorCpf = 0; contadorCpf < docente; contadorCpf++){
- verificaCpf = d[contadorCpf].getCpf();
- if(cpf.equals(verificaCpf)){
- contadorCpf = 99;
- }
- }
- if(contadorCpf == 100){
- System.out.println("Cpf inválido");
- }
- else{
- a[aluno] = new Aluno();
- a[aluno].cadastrarAluno(aluno, cpf);
- aluno++;
- }
- }
- break;
- case 3:
- String siape1;
- String verificaSiape;
- int contSiape;
- ler.nextLine();
- System.out.printf("Digite o SIAPE: ");
- siape1 = ler.nextLine();
- for(contSiape = 0;contSiape < docente; contSiape++){
- verificaSiape = d[contSiape].getSiape();
- if(siape1.equals( verificaSiape)){
- d[contSiape].imprimir();
- contSiape = 100;
- }
- }
- if (contSiape != 101){
- System.out.println("Siape não encontrado");
- }
- break;
- case 4:
- String matricula1;
- String verificaMatricula;
- int contMatricula;
- ler.nextLine();
- System.out.printf("Digite a Matricula: ");
- matricula1 = ler.nextLine();
- System.out.println("");
- for(contMatricula = 0; contMatricula < aluno; contMatricula++){
- verificaMatricula = a[contMatricula].getMatricula();
- if(matricula1.equals(contMatricula)){
- a[contMatricula].imprimir();
- contMatricula = 99;
- }
- }
- if(contMatricula != 100){
- System.out.println("matricula nao encontrada");
- }
- break;
- case 5:
- int y;
- int tipo1;
- int contTipo;
- ler.nextLine();
- System.out.printf("Listar docentes 1.Efetivos 2.Temporários: ");
- y = ler.nextInt();
- System.out.println("");
- if(y == 1){
- for(contTipo = 0; contTipo < docente; contTipo++){
- tipo1 = d[contTipo].getTipo();
- if(tipo1 == y){
- d[contTipo].imprimir();
- tipo++;
- }
- }
- }
- else if(y == 2){
- for(contTipo = 0; contTipo < docente; contTipo++){
- tipo1 = d[contTipo].getTipo();
- if(tipo1 == y){
- d[contTipo].imprimir();
- tipo++;
- }
- }
- }
- if(tipo == 0){
- System.out.println("nao há docente desse tipo");
- System.out.println("");
- }
- tipo = 0;
- break;
- case 6:
- String titulo1;
- String verificaTitulo;
- int contTitulo;
- ler.nextLine();
- System.out.printf("Digite a Sigla da Titulação: ");
- titulo1 = ler.nextLine();
- for(contTitulo = 0; contTitulo < docente; contTitulo++){
- verificaTitulo = d[contTitulo].getTitulo();
- if(titulo1.equals(verificaTitulo)){
- titulo++;
- d[contTitulo].imprimir();
- }
- }
- if(titulo == 0){
- System.out.println("nao existe alguém com essa titulação");
- System.out.println("");
- }
- titulo = 0;
- break;
- case 7:
- int z;
- int verificaCurso;
- int contCurso;
- ler.nextLine();
- System.out.printf("Listar de alunos de um curso 1.Sistemas 2.Agrimessura 3.Agronomia: ");
- z = ler.nextInt();
- for(contCurso = 0; contCurso < aluno ; contCurso++){
- verificaCurso = a[contCurso].getCurso();
- if(verificaCurso == z){
- a[contCurso].imprimir();
- curso++;
- }
- }
- if(curso == 0){
- System.out.println("nao há pessoas nesse curso");
- }
- curso = 0;
- break;
- case 8:
- boolean rei;
- int contReingresso;
- for(contReingresso = 0; contReingresso < aluno; contReingresso++){
- rei = a[contReingresso].getReingresso();
- if(rei == true){
- a[contReingresso].imprimir();
- reingresso++;
- }
- }
- if(reingresso == 0){
- System.out.println("não possui reingressantes");
- }
- reingresso = 0;
- break;
- case 10:
- escolha = 0;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement