Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Programa;
- import java.util.Iterator;
- import java.util.TreeMap;
- import javax.swing.JOptionPane;
- public class Main {
- public static void main(String[] args) {
- TreeMap<String, Personal> instructores = new TreeMap<>();
- int opcion = 0;
- do {
- try {
- opcion = Integer.parseInt(JOptionPane.showInputDialog(null, ""
- + "1.- Registrar Datos"
- + "\n2.- Imprimir Datos"
- + "\n3.- Consultar Datos"
- + "\n4.- Salir"));
- switch (opcion) {
- case 1: {
- String Id = JOptionPane.showInputDialog(null, "Ingrese el ID: ");
- String nombre = JOptionPane.showInputDialog(null, "Ingrese el Nombre: ");
- int edad = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese la Edad: "));
- int titulo = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese el Título Académico:\n1.- Profesionales\n2.-Estudios Tecnológicos"));
- Personal personal = new Personal(nombre, edad, titulo);
- instructores.put(Id, personal);
- break;
- }
- case 2: {
- Iterator it = instructores.keySet().iterator();
- while (it.hasNext()) {
- JOptionPane.showMessageDialog(null,instructores.get(it.next()));
- }
- break;
- }
- case 3: {
- }
- }
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());
- }
- } while (opcion != 4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement