-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeather.java
More file actions
35 lines (34 loc) · 1.35 KB
/
Weather.java
File metadata and controls
35 lines (34 loc) · 1.35 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
34
35
import java.util.Scanner;
public class Weather {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in); //Escribe un programa que pida al usuario que ingrese la temperatura en celcius de su ciudad (La pregunta y la respuesta deberá estar en una sola línea) y según ello devuelva lo siguiente:
System.out.print("¿Qué es la temperatura actual? ");
int temp = scanner.nextInt();
if(temp < 0) {
System.out.println("Te estás congelando");
}
else if (temp <= 10) {
System.out.println("Hace mucho frío ");
}
else if (temp <= 17) {
System.out.println("Con un abrigo estás bien");
}
else if (temp <= 25) {
System.out.println("Parece que ha llegado el verano");
}
else if (temp <= 35) {
System.out.println("Que calooorrrrr");
}
else {
System.out.println("Ahí no hay quien viva");
}
//Si es bajo 0: Te estás congelando
//Si es entre 0 y 10: Hace mucho frío
//Si es entre 11 y 17: Con un abrigo estás bien
//Si es entre 18 y 25: Parece que ha llegado el verano
//Si es entre 26 y 35: Que calooorrrrr
//Si es mayor a 36: Ahí no hay quien viva
//Imprime el resultado
scanner.close();
}
}