-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_interactivo.java
More file actions
33 lines (29 loc) · 1.05 KB
/
Copy pathmenu_interactivo.java
File metadata and controls
33 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.Scanner;
public class menu_interactivo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int opcion;
do {
System.out.println("\n--- MENÚ DE OPCIONES ---");
System.out.println("1. Saludar");
System.out.println("2. Mostrar fecha/hora simulada");
System.out.println("3. Salir");
System.out.print("Selecciona una opción: ");
opcion = sc.nextInt();
switch (opcion) {
case 1:
System.out.println("¡Hola! Bienvenido al sistema.");
break;
case 2:
System.out.println("Entorno de desarrollo activo en UST.");
break;
case 3:
System.out.println("Saliendo del programa...");
break;
default:
System.out.println("Opción no válida.");
}
} while (opcion != 3);
sc.close();
}
}