Skip to content

Commit da7c60a

Browse files
committed
V2 HW ASSIGNMENT CH5
1 parent c401379 commit da7c60a

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

booleans-and-conditionals/exercises/part-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (crewStatus) { THIS IS ANOTHER WAY OF WRITING THE ABOVE STATEMENT BUT BOTH WA
2525

2626
if (computerStatusCode === 200) {
2727
console.log("Please stand by. Computer is rebooting");
28-
} else if (computerStatusCode === 400) {
28+
} else if (computerStatusCode === 400) {
2929
console.log("Success! Computer online.");
3030
} else {
3131
console.log("ALERT: Computer offline!");

booleans-and-conditionals/exercises/part-3.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//V2
2+
//EDITED UPDATED ELSE IF LINES AND TESTED CODE
3+
//THIS EXPECTED OUTPUT IS TO LAUNCH AND OVERRIDE WARNING SIGNS :D
4+
15
let engineIndicatorLight = 'red blinking';
26
let fuelLevel = 21000;
37
let engineTemperature = 1200;
@@ -20,26 +24,30 @@ f) Otherwise, print "Fuel and engine status pending..." */
2024

2125
// Code 5a - 5f here:
2226

23-
if (fuelLevel > 20000 && engineTemperature <= 2500) {
24-
console.log("Full tank. Engines good.");
25-
} else if (fuelLevel > 10000 && engineTemperature <= 2500) {
26-
console.log("Fuel level above 50%. Engines good.");
27-
} else if (fuelLevel > 5000 && engineTemperature <= 2500) {
28-
console.log("Fuel leve above 25%. Engines good.");
27+
28+
if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === 'red blinking') {
29+
console.log("ENGINE FAILURE IMMINENT!");
2930
} else if (fuelLevel <= 5000 || engineTemperature > 2500) {
3031
console.log("Check fuel level. Engines running hot.");
31-
} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === 'red blinking') {
32-
console.log("ENGINE FAILURE IMMINENT!");
33-
} else {
32+
} else if (fuelLevel > 5000 && engineTemperature <= 2500) {
33+
console.log("Fuel level above 25%. Engines good.");
34+
} else if (fuelLevel > 10000 && engineTemperature <= 2500) {
35+
console.log("Fuel level above 50%. Engines good.");
36+
} else if (fuelLevel > 20000 && engineTemperature <= 2500) {//REREAD THE CODE TO BE SURE ALL NUMBERS ARE CORRECT
37+
console.log("Full tank. Engines good.");
38+
} else {
3439
console.log("Fuel and engine status pending...");
3540
}
3641

3742
// 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.
3843

3944
/* 6) b) Code the following if/else check:
4045
If fuelLevel is above 20000 AND engineIndicatorLight is NOT red blinking OR commandOverride is true print "Cleared to launch!" Else print "Launch scrubbed!" */
46+
4147
if (fuelLevel > 20000 && engineIndicatorLight !== 'red blinking' || commandOverride === true) {// alternatively !engineIndicatorLight could be used
4248
console.log("Cleared to launch!");
4349
} else {
4450
console.log("Launch scrubbed!")
45-
}
51+
}
52+
53+

0 commit comments

Comments
 (0)