Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class template {
- public static void main(String[] args) {
- int opcao = 1;
- while(opcao > 0 && opcao < 3) {
- opcao = Integer.parseInt(JOptionPane.showInputDialog("1 - Mostrar nome\n"
- + "2 - Solicitar numero e mostrar se é par\n"
- + "3 - Sair"));
- switch(opcao) {
- case 1:
- JOptionPane.showMessageDialog(null, "Daniel e Matheus");
- break;
- case 2:
- int numero = Integer.parseInt(JOptionPane.showInputDialog("Digite um numero"));
- if(numero%2 == 0) {
- JOptionPane.showMessageDialog(null, "O numero é par");
- }
- else{
- JOptionPane.showMessageDialog(null, "O numero é impar");
- }
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement