Advertisement
argentinapb

main

Oct 12th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.33 KB | None | 0 0
  1. package matheusediogo;
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class MatheusEDiogo {
  7.  
  8. public static void main(String[] args) {
  9. int docente = 0;
  10. int aluno = 0;
  11. String cpf;
  12. String verificaCpf;
  13. int contadorCpf;
  14. int escolha = 1;
  15. int titulo = 0;
  16. int tipo = 0;
  17. int curso = 0;
  18. int reingresso = 0;
  19. Scanner ler = new Scanner(System.in);
  20.  
  21. Aluno[] a = new Aluno[30];
  22. Docente[] d = new Docente[30];
  23. while (escolha != 0){
  24. 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");
  25. escolha = ler.nextInt();
  26. switch(escolha){
  27.  
  28. case 1:
  29. ler.nextLine();
  30. System.out.println("Digite o cpf: ");
  31. cpf = ler.nextLine();
  32.  
  33. for(contadorCpf = 0; contadorCpf < docente; contadorCpf++){
  34. verificaCpf = d[docente].getCpf();
  35. if(cpf.equals(verificaCpf)){
  36. contadorCpf = 99;
  37. }
  38. }
  39.  
  40. if(contadorCpf == 100){
  41. System.out.println("Cpf inválido");
  42. System.out.println("");
  43. }
  44. else{
  45. for(contadorCpf = 0; contadorCpf < aluno; contadorCpf++){
  46. verificaCpf = a[contadorCpf].getCpf();
  47. if(cpf.equals(verificaCpf)){
  48. contadorCpf = 99;
  49. }
  50. }
  51. if(contadorCpf == 100){
  52. System.out.println("Cpf inválido");
  53. System.out.println("");
  54. }
  55.  
  56. else{
  57. d[docente] = new Docente();
  58. d[docente].cadastrarDocente(docente, cpf);
  59. docente++;
  60. }
  61. }
  62.  
  63. break;
  64.  
  65. case 2:
  66. ler.nextLine();
  67. System.out.println("Digite o cpf: ");
  68. cpf = ler.nextLine();
  69.  
  70. for(contadorCpf = 0; contadorCpf < aluno; contadorCpf++){
  71. verificaCpf = a[contadorCpf].getCpf();
  72. if(cpf.equals(verificaCpf)){
  73. contadorCpf = 99;
  74. }
  75. }
  76. if(contadorCpf == 100){
  77. System.out.println("Cpf inválido");
  78.  
  79. }
  80. else{
  81. for(contadorCpf = 0; contadorCpf < docente; contadorCpf++){
  82.  
  83. verificaCpf = d[contadorCpf].getCpf();
  84. if(cpf.equals(verificaCpf)){
  85. contadorCpf = 99;
  86. }
  87. }
  88. if(contadorCpf == 100){
  89. System.out.println("Cpf inválido");
  90.  
  91. }
  92. else{
  93. a[aluno] = new Aluno();
  94. a[aluno].cadastrarAluno(aluno, cpf);
  95. aluno++;
  96. }
  97. }
  98. break;
  99.  
  100. case 3:
  101. String siape1;
  102. String verificaSiape;
  103. int contSiape;
  104. ler.nextLine();
  105. System.out.printf("Digite o SIAPE: ");
  106. siape1 = ler.nextLine();
  107.  
  108. for(contSiape = 0;contSiape < docente; contSiape++){
  109.  
  110. verificaSiape = d[contSiape].getSiape();
  111.  
  112. if(siape1.equals( verificaSiape)){
  113. d[contSiape].imprimir();
  114. contSiape = 100;
  115. }
  116.  
  117. }
  118. if (contSiape != 101){
  119. System.out.println("Siape não encontrado");
  120.  
  121. }
  122. break;
  123.  
  124. case 4:
  125.  
  126. String matricula1;
  127. String verificaMatricula;
  128. int contMatricula;
  129. ler.nextLine();
  130. System.out.printf("Digite a Matricula: ");
  131. matricula1 = ler.nextLine();
  132. System.out.println("");
  133. for(contMatricula = 0; contMatricula < aluno; contMatricula++){
  134.  
  135. verificaMatricula = a[contMatricula].getMatricula();
  136.  
  137. if(matricula1.equals(contMatricula)){
  138.  
  139. a[contMatricula].imprimir();
  140. contMatricula = 99;
  141. }
  142.  
  143. }
  144.  
  145. if(contMatricula != 100){
  146. System.out.println("matricula nao encontrada");
  147.  
  148. }
  149. break;
  150.  
  151. case 5:
  152.  
  153. int y;
  154. int tipo1;
  155. int contTipo;
  156. ler.nextLine();
  157.  
  158. System.out.printf("Listar docentes 1.Efetivos 2.Temporários: ");
  159. y = ler.nextInt();
  160. System.out.println("");
  161. if(y == 1){
  162. for(contTipo = 0; contTipo < docente; contTipo++){
  163. tipo1 = d[contTipo].getTipo();
  164.  
  165. if(tipo1 == y){
  166. d[contTipo].imprimir();
  167. tipo++;
  168. }
  169.  
  170. }
  171. }
  172. else if(y == 2){
  173. for(contTipo = 0; contTipo < docente; contTipo++){
  174. tipo1 = d[contTipo].getTipo();
  175. if(tipo1 == y){
  176. d[contTipo].imprimir();
  177. tipo++;
  178. }
  179.  
  180. }
  181. }
  182. if(tipo == 0){
  183. System.out.println("nao há docente desse tipo");
  184. System.out.println("");
  185. }
  186. tipo = 0;
  187. break;
  188.  
  189. case 6:
  190.  
  191. String titulo1;
  192. String verificaTitulo;
  193. int contTitulo;
  194. ler.nextLine();
  195. System.out.printf("Digite a Sigla da Titulação: ");
  196. titulo1 = ler.nextLine();
  197.  
  198. for(contTitulo = 0; contTitulo < docente; contTitulo++){
  199.  
  200. verificaTitulo = d[contTitulo].getTitulo();
  201.  
  202. if(titulo1.equals(verificaTitulo)){
  203. titulo++;
  204. d[contTitulo].imprimir();
  205. }
  206.  
  207. }
  208. if(titulo == 0){
  209. System.out.println("nao existe alguém com essa titulação");
  210. System.out.println("");
  211. }
  212. titulo = 0;
  213. break;
  214.  
  215. case 7:
  216.  
  217. int z;
  218. int verificaCurso;
  219. int contCurso;
  220. ler.nextLine();
  221.  
  222. System.out.printf("Listar de alunos de um curso 1.Sistemas 2.Agrimessura 3.Agronomia: ");
  223. z = ler.nextInt();
  224. for(contCurso = 0; contCurso < aluno ; contCurso++){
  225. verificaCurso = a[contCurso].getCurso();
  226.  
  227. if(verificaCurso == z){
  228. a[contCurso].imprimir();
  229. curso++;
  230. }
  231.  
  232. }
  233.  
  234. if(curso == 0){
  235. System.out.println("nao há pessoas nesse curso");
  236.  
  237. }
  238. curso = 0;
  239. break;
  240.  
  241. case 8:
  242.  
  243. boolean rei;
  244. int contReingresso;
  245.  
  246.  
  247. for(contReingresso = 0; contReingresso < aluno; contReingresso++){
  248. rei = a[contReingresso].getReingresso();
  249.  
  250. if(rei == true){
  251. a[contReingresso].imprimir();
  252. reingresso++;
  253. }
  254.  
  255. }
  256. if(reingresso == 0){
  257. System.out.println("não possui reingressantes");
  258.  
  259. }
  260. reingresso = 0;
  261. break;
  262. case 10:
  263. escolha = 0;
  264. break;
  265. }
  266. }
  267. }
  268. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement