Advertisement
Guest User

main

a guest
Dec 11th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. package Programa;
  2.  
  3. import java.util.Iterator;
  4. import java.util.TreeMap;
  5. import javax.swing.JOptionPane;
  6.  
  7. public class Main {
  8.  
  9.     public static void main(String[] args) {
  10.  
  11.         TreeMap<String, Personal> instructores = new TreeMap<>();
  12.  
  13.         int opcion = 0;
  14.  
  15.         do {
  16.             try {
  17.                 opcion = Integer.parseInt(JOptionPane.showInputDialog(null, ""
  18.                         + "1.- Registrar Datos"
  19.                         + "\n2.- Imprimir Datos"
  20.                         + "\n3.- Consultar Datos"
  21.                         + "\n4.- Salir"));
  22.                 switch (opcion) {
  23.                     case 1: {
  24.                         String Id = JOptionPane.showInputDialog(null, "Ingrese el ID: ");
  25.                         String nombre = JOptionPane.showInputDialog(null, "Ingrese el Nombre: ");
  26.                         int edad = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese la Edad: "));
  27.                         int titulo = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese el Título Académico:\n1.- Profesionales\n2.-Estudios Tecnológicos"));
  28.  
  29.                         Personal personal = new Personal(nombre, edad, titulo);
  30.  
  31.                         instructores.put(Id, personal);
  32.                         break;
  33.                     }
  34.  
  35.                     case 2: {
  36.                         Iterator it = instructores.keySet().iterator();
  37.                         while (it.hasNext()) {
  38.                             JOptionPane.showMessageDialog(null,instructores.get(it.next()));
  39.                         }
  40.                         break;
  41.                     }
  42.                    
  43.                     case 3: {
  44.                        
  45.                     }
  46.  
  47.                 }
  48.             } catch (Exception ex) {
  49.                 JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());
  50.             }
  51.         } while (opcion != 4);
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement