You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letengineIndicatorLight="red blinking";//THIS IS A STRING NOT A VARIABLE SO "" ARE ADDED
2
2
letspaceSuitsOn=true;
3
3
letshuttleCabinReady=true;
4
4
letcrewStatus=spaceSuitsOn&&shuttleCabinReady;
@@ -9,13 +9,53 @@ let shuttleSpeed = 15000;
9
9
10
10
// a) If crewStatus is true, print "Crew Ready" else print "Crew Not Ready".
11
11
12
-
12
+
if(crewStatus===true){
13
+
console.log("Crew Ready");// ; IS ON THIS LINE NOT AT THE FIRST LINE
14
+
}else{
15
+
console.log("Crew Not Ready");
16
+
}
17
+
/*
18
+
if (crewStatus) { THIS IS ANOTHER WAY OF WRITING THE ABOVE STATEMENT BUT BOTH WAYS ARE CORRECT?
19
+
console.log("Crew Ready");
20
+
} else {
21
+
console.log("Crew Not Ready");
22
+
}
23
+
*/
13
24
// b) If computerStatusCode is 200, print "Please stand by. Computer is rebooting." Else if computerStatusCode is 400, print "Success! Computer online." Else print "ALERT: Computer offline!"
14
25
26
+
if(computerStatusCode===200){
27
+
console.log("Please stand by. Computer is rebooting");
28
+
}elseif(computerStatusCode===400){
29
+
console.log("Success! Computer online.");
30
+
}else{
31
+
console.log("ALERT: Computer offline!");
32
+
}
33
+
15
34
16
35
// c) If shuttleSpeed is > 17,500, print "ALERT: Escape velocity reached!" Else if shuttleSpeed is < 8000, print "ALERT: Cannot maintain orbit!" Else print "Stable speed".
17
36
18
37
38
+
if(shuttleSpeed>17500){
39
+
console.log("ALERT: Escape velocity reached!");
40
+
}elseif(shuttleSpeed<8000){
41
+
console.log("ALERT: Cannot maintain orbit!");
42
+
}else{
43
+
console.log("Stable speed");
44
+
}
45
+
19
46
// 4) PREDICT: Do the code blocks shown in the 'predict.txt' file produce the same result?
20
47
21
-
console.log(/* "Yes" or "No" */);
48
+
/*COMPARE THESE TWO LOOPS TO PREDICT THE OUTCOME!
49
+
if (crewStatus && computerStatusCode === 200 && spaceSuitsOn) {
50
+
console.log("all systems go");
51
+
} else {
52
+
console.log("WARNING. Not ready");
53
+
}
54
+
if (!crewStatus || computerStatusCode !== 200 || !spaceSuitsOn) {
// 6) a) Create the variable commandOverride, and set it to be true or false. If commandOverride is false, then the shuttle should only launch if the fuel and engine check are OK. If commandOverride is true, then the shuttle will launch regardless of the fuel and engine status.
22
38
23
39
/* 6) b) Code the following if/else check:
24
40
If fuelLevel is above 20000 AND engineIndicatorLight is NOT red blinking OR commandOverride is true print "Cleared to launch!" Else print "Launch scrubbed!" */
41
+
if(fuelLevel>20000&&engineIndicatorLight!=='red blinking'||commandOverride===true){// alternatively !engineIndicatorLight could be used
0 commit comments