Você está na página 1de 3

MENU CON WHILE - OPCION NUMERICA

/*
* To change this license header, choose License Headers in
Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aplicacion1;

/**
*
* @author cipg Operadores Matematicos y Funciones Matematicas con
Scanner
*/
import java.util.Scanner;
import java.io.IOException;
public class menu{

/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
// TODO code application logic here
Scanner lectura = new Scanner(System.in); //Se crea el
lector
int repetir=1;
while(repetir==1){
System.out.println("Fundacion Universitaria
Panamericana");
System.out.println("Set de Programas");
System.out.println("1. Nomina");
System.out.println("2. Factura");
System.out.println("3. Movimiento Uniforme");
System.out.println("Digite la Opcion:");
int opcion=lectura.nextInt();
switch(opcion){
case 1:Aplicacion1.main(args);
break;
case 2:Aplicacion2.main(args);
break;
case 3:Aplicacion3.main(args);
break;
default:
System.out.println("LA opcion no esta en el Menu");
break;
}
System.out.println("Desea repetir el proceso==>1:si
2:No");
repetir=lectura.nextInt();

}//fin del while


}
}

MENU CON WHILE - OPCION CADENA

/*
* To change this license header, choose License Headers in
Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aplicacion1;

/**
*
* @author cipg Operadores Matematicos y Funciones Matematicas con
Scanner
*/
import java.util.Scanner;
import java.io.IOException;
public class menucadena{

/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
// TODO code application logic here
Scanner lectura = new Scanner(System.in); //Se crea el
lector
String repetir="si";
while(repetir.equals("si") || repetir.equals("SI")){
System.out.println("Fundacion Universitaria
Panamericana");
System.out.println("Set de Programas");
System.out.println("1. Nomina");
System.out.println("2. Factura");
System.out.println("3. Movimiento Uniforme");
System.out.println("Digite la Opcion:");
int opcion=lectura.nextInt();
switch(opcion){
case 1:Aplicacion1.main(args);
break;
case 2:Aplicacion2.main(args);
break;
case 3:Aplicacion3.main(args);
break;
default:
System.out.println("LA opcion no esta en el Menu");
break;
}
System.out.println("Desea repetir el proceso==>si / no");
repetir=lectura.nextLine();

}//fin del while

}
}

Você também pode gostar