Guest User

Untitled

a guest
Oct 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. /**
  2. *
  3. */
  4. package br.com.fiap.controler;
  5.  
  6. import java.util.ArrayList;
  7. import java.util.Iterator;
  8. import java.util.List;
  9. import java.util.Scanner;
  10.  
  11. import br.com.fiap.model.entity.Ong;
  12. import br.com.fiap.model.entity.Voluntarios;
  13.  
  14. /**
  15. * @author Guilherme
  16. *
  17. */
  18. public class OngAplication {
  19. private static Scanner leia = null;
  20. private static Scanner scanner = null;
  21. private static List <Ong> listaOng = new ArrayList<Ong>();
  22. private static List <Voluntarios> listaVoluntarios = new ArrayList<Voluntarios>();
  23. private static Iterator<Voluntarios> it = null;
  24. private static Voluntarios voluntario = null;
  25.  
  26.  
  27. public OngAplication() throws IllegalArgumentException{
  28. Integer opcaoEscolhida = 0;
  29. Boolean continua = true;
  30. do{
  31. System.out.println("Digite a operacao");
  32. System.out.println("1- Adicionar Ong e Voluntario| 2- Listar Ong| 4- Listar Ong com funcionarios| " +
  33. "5- Listar Ong por area| 6- Mostrar Ong com maior numero de voluntarios| 7- Mostrar Ong com menor numero de Voluntarios| 8- Alterar area Ong| 9- Sair");
  34. leia = new Scanner(System.in);
  35. opcaoEscolhida = leia.nextInt();
  36. leia.nextLine();
  37. switch (opcaoEscolhida) {
  38. case 1:
  39. criaOngVol();
  40. break;
  41. case 2:
  42. listarOng();
  43. break;
  44. case 3:
  45. break;
  46. case 4:
  47. break;
  48. case 5:
  49. break;
  50. case 6:
  51. break;
  52. case 7:
  53. break;
  54. case 8:
  55. break;
  56. case 9:
  57. break;
  58. default:
  59. continue;
  60. }
  61. }while(continua);
  62. }
  63.  
  64. public static void criaOngVol(){
  65. Ong novoOng = listaOngs(0);
  66. scanner = new Scanner(System.in);
  67. System.out.println("Informe o nome da Ong");
  68. novoOng.setNome(scanner.next());
  69. System.out.println("Informe a area da Ong");
  70. novoOng.setDescricao(scanner.next());
  71.  
  72. Voluntarios vol = new Voluntarios();
  73. scanner = new Scanner(System.in);
  74. System.out.println("Informe o nome do voluntario");
  75. vol.setNome(scanner.next());
  76. System.out.println("Informe o rg");
  77. vol.setRg(scanner.next());
  78. List<Voluntarios> voluntarios = novoOng.getListaVoluntarios();
  79.  
  80. listaOng.add(novoOng);
  81. }
  82.  
  83. public static void listarOng(){
  84. for (Ong ong : listaOng) {
  85. System.out.println(ong.getNome() + "\t Area (" + ong.getDescricao() + ") \t");
  86. System.out.println("--------------------------------------------------------");
  87. }
  88. }
  89. }
Add Comment
Please, Sign In to add comment