|
@@ -5,12 +5,26 @@
|
5
|
5
|
* @author (your name)
|
6
|
6
|
* @version (a version number or a date)
|
7
|
7
|
*/
|
|
8
|
+
|
8
|
9
|
public class WriteIFs
|
9
|
10
|
{
|
|
11
|
+ int x;
|
|
12
|
+ int tt_t;
|
|
13
|
+ int tt_s;
|
|
14
|
+ int oo1, oo2;
|
|
15
|
+ String ss;
|
10
|
16
|
|
11
|
17
|
public void playerDied(boolean player1) {
|
12
|
18
|
// Write an IF statement that checks “player1.isAlive()”
|
13
|
19
|
// and if that’s false, calls “displayGameOver(player1)”
|
|
20
|
+ if(isAlive(true))
|
|
21
|
+ {
|
|
22
|
+ System.out.println(player1);
|
|
23
|
+ }
|
|
24
|
+ else
|
|
25
|
+ {
|
|
26
|
+ displayGameOver(player1);
|
|
27
|
+ }
|
14
|
28
|
|
15
|
29
|
}
|
16
|
30
|
|
|
@@ -18,9 +32,14 @@ public class WriteIFs
|
18
|
32
|
// Write an IF statement that checks the
|
19
|
33
|
// “temperature(room)” and if that check is less than 70,
|
20
|
34
|
// calls “heatOn()” else calls “coolOn()”
|
|
35
|
+ if(temperature(room)<70)
|
|
36
|
+ {
|
|
37
|
+ heatOn();
|
|
38
|
+ }
|
|
39
|
+ else {
|
|
40
|
+ coolOn();
|
|
41
|
+ }
|
21
|
42
|
|
22
|
|
-
|
23
|
|
-
|
24
|
43
|
return this.ss;
|
25
|
44
|
}
|
26
|
45
|
|
|
@@ -30,30 +49,25 @@ public class WriteIFs
|
30
|
49
|
// AND
|
31
|
50
|
// “insideTemp()” is less than 62,
|
32
|
51
|
// calls “startAFire(fireplace1)”
|
|
52
|
+ if((outsideTemp() < 50) || (insideTemp()<62))
|
|
53
|
+ {
|
|
54
|
+ startAFire(fireplace1);
|
|
55
|
+ }
|
|
56
|
+
|
33
|
57
|
|
34
|
58
|
}
|
35
|
59
|
|
36
|
60
|
public void checkFuel(double fuelLevel) {
|
37
|
61
|
// Write an IF statement that checks “fuelLevel”
|
38
|
62
|
// and if that check is less than 0.08, calls “refuel()”
|
|
63
|
+ if(fuelLevel < 0.08)
|
|
64
|
+ {
|
|
65
|
+ refuel();
|
|
66
|
+ }
|
39
|
67
|
|
40
|
68
|
}
|
41
|
69
|
|
42
|
70
|
|
43
|
|
-
|
44
|
|
- /**
|
45
|
|
- * Pay no attention to the code below this point.
|
46
|
|
- *
|
47
|
|
- *
|
48
|
|
- * instance variables
|
49
|
|
- * /
|
50
|
|
- int x;
|
51
|
|
- int tt_t;
|
52
|
|
- int tt_s;
|
53
|
|
- int oo1, oo2;
|
54
|
|
- String ss;
|
55
|
|
-
|
56
|
|
-
|
57
|
71
|
/**
|
58
|
72
|
* Constructor for objects of class WriteIFs
|
59
|
73
|
*/
|
|
@@ -70,9 +84,10 @@ public class WriteIFs
|
70
|
84
|
|
71
|
85
|
// associated routines
|
72
|
86
|
public boolean isAlive(boolean p) {
|
|
87
|
+
|
73
|
88
|
return !p;
|
74
|
89
|
}
|
75
|
|
- private int tempurature(int t) {
|
|
90
|
+ private int temperature(int t) {
|
76
|
91
|
return t+2;
|
77
|
92
|
}
|
78
|
93
|
private void heatOn() {
|