Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- */
- package br.com.fiap.controler;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Scanner;
- import br.com.fiap.model.entity.Ong;
- import br.com.fiap.model.entity.Voluntarios;
- /**
- * @author Guilherme
- *
- */
- public class OngAplication {
- private static Scanner leia = null;
- private static Scanner scanner = null;
- private static List <Ong> listaOng = new ArrayList<Ong>();
- private static List <Voluntarios> listaVoluntarios = new ArrayList<Voluntarios>();
- private static Iterator<Voluntarios> it = null;
- private static Voluntarios voluntario = null;
- public OngAplication() throws IllegalArgumentException{
- Integer opcaoEscolhida = 0;
- Boolean continua = true;
- do{
- System.out.println("Digite a operacao");
- System.out.println("1- Adicionar Ong e Voluntario| 2- Listar Ong| 4- Listar Ong com funcionarios| " +
- "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");
- leia = new Scanner(System.in);
- opcaoEscolhida = leia.nextInt();
- leia.nextLine();
- switch (opcaoEscolhida) {
- case 1:
- criaOngVol();
- break;
- case 2:
- listarOng();
- break;
- case 3:
- break;
- case 4:
- break;
- case 5:
- break;
- case 6:
- break;
- case 7:
- break;
- case 8:
- break;
- case 9:
- break;
- default:
- continue;
- }
- }while(continua);
- }
- public static void criaOngVol(){
- Ong novoOng = listaOngs(0);
- scanner = new Scanner(System.in);
- System.out.println("Informe o nome da Ong");
- novoOng.setNome(scanner.next());
- System.out.println("Informe a area da Ong");
- novoOng.setDescricao(scanner.next());
- Voluntarios vol = new Voluntarios();
- scanner = new Scanner(System.in);
- System.out.println("Informe o nome do voluntario");
- vol.setNome(scanner.next());
- System.out.println("Informe o rg");
- vol.setRg(scanner.next());
- List<Voluntarios> voluntarios = novoOng.getListaVoluntarios();
- listaOng.add(novoOng);
- }
- public static void listarOng(){
- for (Ong ong : listaOng) {
- System.out.println(ong.getNome() + "\t Area (" + ong.getDescricao() + ") \t");
- System.out.println("--------------------------------------------------------");
- }
- }
- }
Add Comment
Please, Sign In to add comment