Ejercicios estructura repetitiva
This commit is contained in:
1 parent
70b99a0a23
commit
99ade1ddb3
6 files changed
+113
-16
No files matched your search
@@ -1,3 +1,25 @@
|
||||
void main() {
|
||||
$END$
|
||||
import java.util.*;
|
||||
|
||||
public class EstructuraRepetitiva1 {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
boolean repetir = true;
|
||||
while(repetir){
|
||||
System.out.printf("1.-Opción1\n2.-Opción2\n3.-Opción3\n4.-Finalizar\n");
|
||||
String opt = sc.nextLine();
|
||||
switch(opt){
|
||||
case "1", "2", "3":
|
||||
System.out.println("============================");
|
||||
System.out.printf("Has seleccionado la opción %s\n", opt);
|
||||
System.out.println("============================");
|
||||
break;
|
||||
case "4":
|
||||
System.out.println("Finalizando proceso");
|
||||
repetir = false;
|
||||
break;
|
||||
default:
|
||||
System.out.println("Opción inválida");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user