-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeather.java
More file actions
44 lines (31 loc) · 890 Bytes
/
Weather.java
File metadata and controls
44 lines (31 loc) · 890 Bytes
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
import java.util.Scanner;
public class Weather{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter temperature: ");
int celsius = input.nextInt();
if(celsius < 0){
System.out.print("it is freezing");
}
else if(celsius == 0 || celsius <= 15 ){
System.out.print("It is cold");
}
else if(celsius == 16 || celsius <= 25 ){
System.out.print("It is warm");
}
else{
System.out.print("It is hot");
}
}
}
/*
prompt the user to enter their temperature
create a variable that reads the users input
check if their temperature is less than zero
print"it is freezing"
Check if the user temperature is equal to zero or it is less than or equals to 15
print"It is cold"
check again if the user temperature is equals to 16 or it is less than or equals to 25
print "It is warm "
else "it is hot"
*/