-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5.kt
53 lines (48 loc) · 1.12 KB
/
5.kt
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
53
fun main() {
println(queMeses(5))
println(aQueTrimestrePer(12))
println(semestre(11973))
print(tipoDeVar(5/2))
}
fun semestre(mes:Int):String{
return when(mes){
in 1..6->"Primer semestre"
in 7..12->"Segundo semestre"
!in 1..12->"Semestre no encontrado"
else->"not F"
}
}
fun queMeses(mes:Int):String{
return when(mes){
1->"Enero"
2->"Febrero"
3->"Marzo"
4->"Abril"
5->"Mayo"
6->"Junio"
7->"Julio"
8->"Agosto"
9->"Septiembre"
10->"Octubre"
11->"Noviembre"
12->"Diciembre"
else-> "Me no valido en el calendario gregoriano"
}
}
fun aQueTrimestrePer(mes:Int):String{
return when(mes){
in 1..3->"Primer trimestre"
in 4..6->"Segundo trimestres"
in 7..9->"Tercer trimestre"
in 10..12->"Cuarto trimestre"
else->"No hay más trimestres conocidos..."
}
}
fun tipoDeVar(tipo:Any):String{
return when (tipo){
is String -> "Es una variable de tipo String"
is Int -> "Es un numero"
is Boolean->"Es un boleano"
else->"No es de tipo aceptado..."
}
}