-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab1_Question4.java
More file actions
56 lines (29 loc) · 992 Bytes
/
Lab1_Question4.java
File metadata and controls
56 lines (29 loc) · 992 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
45
46
47
48
49
50
51
52
53
54
55
56
package day14_methodsPart2;
public class Lab1_Question4 {
public static void main(String[] args) {
// olcay // Jun 15, 2020
//Question-4
/*The deers in VA spend most of the day playing. In particular, they play if the temperature is between 60 and 90.
* Unless it is summer,
* then the upper limit is 100 instead of 90.
* Write a method that accepts temperature and a boolean isSummer, prints true if the deers play and false otherwise.*/
playOrNot(70, false);
playOrNot(95, false);
playOrNot(95, true);
}
private static void playOrNot(double temperature, boolean isSummer) {
if(isSummer) {
if(temperature>60 && temperature<100) {
System.out.println(true);
}else {
System.out.println(false);
}
}else {
if(temperature>60 && temperature<90) {
System.out.println(true);
}else {
System.out.println(false);
}
}
}
}