Título: Como regresar al menu principal Publicado por: JoseRiiivera en 26 Abril 2014, 21:14 pm Hola necesito ayuda urgente, he trado de regresar al menu principal del sgt programa y no he podido alguien que me ayude por favor... el programa aun no esta completo.
import java.util.*; import javax.swing.*; public class Menu { public static void main (String [] args){ int menu=0, i=0, cuentas=0, password=0,p=0,R=0; String s=""; String cedula=""; String informacion=""; Vector x= new Vector (); menu=Integer.parseInt(JOptionPane.showInputDialog("OPCIONES\n1. Registro de usuarios \n2. Actualizar Datos\n3. Consultar Saldo\n4. Retiros\n5. Consignar")); switch (menu){ case 1: x.add(JOptionPane.showInputDialog("Ingrese Cedula")); x.add(JOptionPane.showInputDialog("Ingrese Nombre")); x.add(JOptionPane.showInputDialog("Ingrese Apeliido")); x.add(JOptionPane.showInputDialog("Ingrese Sexo")); cuentas=Integer.parseInt(JOptionPane.showInputDialog("1. Tarjeta Credito\n2. Tarjeta Debido\n3 Ambas Tarjetas")); if (cuentas==1){ x.add(JOptionPane.showInputDialog("Ingrese Tarjeta Credito")); x.add(JOptionPane.showInputDialog("Ingrese Clave Tarjeta.Credito")); x.add(JOptionPane.showInputDialog("Ingrese Dinero Tarjeta Credito")); } if (cuentas==2){ x.add(""); x.add(""); x.add(""); x.add(JOptionPane.showInputDialog("Ingrese Tarjeta Debito")); x.add(JOptionPane.showInputDialog("Ingrese Clave Tarjeta Debito")); x.add(JOptionPane.showInputDialog("Ingrese Dinero Tarjeta Credito")); } if (cuentas==3){ x.add(JOptionPane.showInputDialog("Ingrese Tarjeta Credito")); x.add(JOptionPane.showInputDialog("Ingrese Clave Tarjeta.Credito")); x.add(JOptionPane.showInputDialog("Ingrese Dinero Tarjeta Credito")); x.add(JOptionPane.showInputDialog("Ingrese Tarjeta Debito")); x.add(JOptionPane.showInputDialog("Ingrese Clave Tarjeta Debito")); x.add(JOptionPane.showInputDialog("Ingrese Dinero Tarjeta Credito")); } p=Integer.parseInt(JOptionPane.showInputDialog("Ingrese 0 Regresar al menu principal")); /*for (i=0;i<=x.size();i++){ JOptionPane.showMessageDialog(null, "Sus datos son: " +x.get(i)); } *///MUESTA LOS DATOS break; case 2: cedula=JOptionPane.showInputDialog("Ingrese Cedula"); for (i=0;i<=x.size();i=i+9){ if (cedula.equals(x.get(i).toString())){ for (i=0;i<=x.size();i++) { JOptionPane.showMessageDialog(null, "Sus datos son:" +x.get(i)); } } } break; } } } Título: Re: Como regresar al menu principal Publicado por: gordo23 en 28 Abril 2014, 08:37 am Podés usar un ciclo while, con la condición de que si no seleccionas la opción salir (por ejemplo) el menu se repite.
|