switch_meses.java 654 Bytes
Newer Older
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

public class switch_meses {
    public static void main (String[] arg) {
		String dia_m;
		System.out.println("Ingresar mes");
		dia_m = System.console().readLine();
		
		String mes;
		
		switch (dia_m) 
		{
			case "12":
				
			
			case "1":
				
			
			case "2":		
				mes = "Verano";
				break;
			case "3":
				
			case "4":
				
			case "5": 
				
				mes = "Otonio";
				break;
			case "6":
				
			case "7":
				
			case "8":				
				mes = "invierno";
				break;
				
			case "9":
				
			case "10":
				
			case "11":
				mes = "Primavera";
				break;
			
			default: mes = "lang inválido";
			break;
		
		}
		System.out.println(mes);
		
	}
}