File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Ejercicios/src/EstructuraDeControl Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ package EstructuraDeControl ;
2+
3+ /*
4+ Enunciado: Al ingresar un número entre 1 y 4 devolver la estación del
5+ año de acuerdo a la siguiente tabla.
6+ | Número | Estación |
7+ | :-----: | :-------- |
8+ | 1 | Verano |
9+ | 2 | Otoño |
10+ | 3 | Invierno |
11+ | 4 | Primavera |
12+
13+ Análisis: Para la solución de este problema, se requiere que el usuario
14+ ingrese un número entero y el sistema realice el proceso para devolver la estación.
15+ --Entrada--
16+ Número (n).
17+ --Salida--
18+ Estación (e).
19+ */
20+ import java .util .Scanner ;
21+
22+ public class Estaciones {
23+ public static void main (String [] args ) {
24+ Scanner scanner =new Scanner (System .in );
25+ //ENTRADA
26+ System .out .print ("Ingrese un numero(entre 1 y 4): " );
27+ int n =scanner .nextInt ();
28+ String estacion ="" ;
29+ //OPERACION
30+ switch (n ) {
31+ case 1 :estacion ="Verano" ;break ;
32+ case 2 :estacion ="Otoño" ;break ;
33+ case 3 :estacion ="Invierno" ;break ;
34+ case 4 :estacion ="Primavera" ;break ;
35+ default :
36+ System .out .println ("Numero invalido(solo puede digitar numeros del 1 al 4 )" );;break ;
37+ }
38+ //SALIDA
39+ System .out .println (estacion );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments