Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Aplicacao {
- /**
- * @param args
- */
- public static void main(String[] args) {
- String nome=JOptionPane.showInputDialog("Nome: ");
- int idade=Integer.parseInt(JOptionPane.showInputDialog("Idade: "));
- Pessoa pessoa=new Pessoa(nome,idade);
- int opcao;
- do
- {
- opcao=Integer.parseInt(JOptionPane.showInputDialog(null, "Escolha: \n1-Cadastrar Filho \n2-Imprimir dados do Filho \n3-Sair "));
- switch (opcao)
- {
- case 1:
- String filho=JOptionPane.showInputDialog("Nome do 1° filho: ");
- String filho2=JOptionPane.showInputDialog("Nome do 2° filho: ");
- String filho3=JOptionPane.showInputDialog("Nome do 3° filho: ");
- pessoa.CadastrarFilho(new Pessoa(filho,2));
- pessoa.CadastrarFilho(new Pessoa(filho2,4));
- pessoa.CadastrarFilho(new Pessoa(filho3,5));
- break;
- case 2:
- System.out.println(pessoa.toString());
- break;
- default:
- System.out.println("Opção invalida!!!");
- break;
- }
- }
- while(opcao==1||opcao==2);
- }
- }
Add Comment
Please, Sign In to add comment