-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
54 lines (41 loc) · 1.82 KB
/
Copy pathtest.java
File metadata and controls
54 lines (41 loc) · 1.82 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package ActivityRecommendationProgram;
import java.util.Scanner;
/**
* @author Fatih ARI - 18.08.2021
* An activity recommendation program was designed according to the air temperature.
* The user must enter a temperature value.
*
* Conditions:
* Suggest to "Ski" if the temperature is less than 5.
* Suggest the "Cinema" event if the temperature is between 5 and 15.
* Suggest the "Picnic" event if the temperature is between 15 and 25.
* Suggest the "Swimming" event if the temperature is greater than 25.
*/
public class test {
static short temperature;
public static void gettingInput()
{
Scanner input = new Scanner(System.in);
System.out.print("Enter the temperature degree: ");
temperature = input.nextShort();
input.close();
}
public static void recommendEvent()
{
if(temperature < 5)
System.out.print("The weather is "+ temperature + " degree. It's too cold.\nYou can start preparing for \"skiing.\" ");
else if(temperature >= 5 && temperature < 15)
System.out.print("The weather is "+ temperature + " degree. It's cold.\nYou can go to \"cinema.\" ");
else if(temperature == 15)
System.out.print("The weather is "+ temperature + " degree. It's warm.\nYou can go to \"cinema.\" or You can have a \"picnic.\" ");
else if(temperature > 15 && temperature <= 25)
System.out.print("The weather is "+ temperature + " degree. It's warm.\nYou can have a \"picnic.\" ");
else if(temperature > 25 )
System.out.print("The weather is "+ temperature + " degree. It's hot.\nYou can \"swim.\" ");
}
public static void main(String[] args)
{
gettingInput();
recommendEvent();
}
}