-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrincipal.java
39 lines (35 loc) · 1.3 KB
/
Principal.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import javax.swing.JOptionPane;
public class Principal {
public static void main(String[] args) {
String menu = "1-Cadastrar\n2-Atualizar\n3 -Apagar\n4-Listar\n0-Sair";
int op = 0;
do{
try{
op = Integer.parseInt(JOptionPane.showInputDialog(menu));
switch(op){
case 1:
String nome = JOptionPane.showInputDialog("Digite o Nome:");
String fone = JOptionPane.showInputDialog("Digite o Fone:");
String email = JOptionPane.showInputDialog("Digite o Email:");
Pessoa p = new Pessoa(nome, fone, email);
p.inserir();
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 0:
break;
default:
JOptionPane.showMessageDialog(null, "Opção inválida!");
}
}
catch (Exception e){
JOptionPane.showMessageDialog(null, "Falhou!");
System.out.println(e.getMessage());
}
} while (op != 0);
}
}