Skip to content

Commit 1c6e394

Browse files
committed
<space>
1 parent 402ab04 commit 1c6e394

8 files changed

+59
-13
lines changed

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

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
// Declare and initialize the variables for exercise 1 here:
1+
let engineIndicatorLight = "red blinking";
2+
let spaceSuitsOn = true;
3+
let shuttleCabinReady = true;
4+
let crewStatus = spaceSuitsOn && shuttleCabinReady;
5+
let computerStatusCode = 200;
6+
let shuttleSpeed = 15000// Declare and initialize the variables for exercise 1 here:
27

38
// BEFORE running the code, predict what will be printed to the console by the following statements:
49

@@ -9,3 +14,48 @@ if (engineIndicatorLight === "green") {
914
} else {
1015
console.log("engines are off");
1116
}
17+
18+
if (crewStatus) {
19+
console.log("Crew Ready");
20+
} else {
21+
console.log("Crew Not Ready");
22+
}
23+
24+
if (computerStatusCode === 200) {
25+
console.log("Please stand by. Computer is rebooting.");
26+
} else if (computerStatusCode === 400) {
27+
console.log("Success! Computer online.");
28+
} else {
29+
console.log("ALERT: Computer offline!");
30+
}
31+
32+
if (shuttleSpeed > 17500) {
33+
console.log("ALERT: Escape velocity reached!");
34+
} else if (shuttleSpeed < 8000) {
35+
console.log("ALERT: Cannot maintain orbit!");
36+
} else {
37+
console.log("Stable speed.");
38+
}
39+
if (!crewStatus || computerStatusCode !== 200 || !spaceSuitsOn) {
40+
console.log("WARNING. Not ready");
41+
} else {
42+
console.log("all systems go");
43+
}
44+
45+
let fuelLevel = 12000;
46+
let engineTemperature = 2600;
47+
48+
if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){
49+
console.log("ENGINE FAILURE IMMINENT!");
50+
} else if (fuelLevel <= 5000 || engineTemperature > 2500){
51+
console.log("Check fuel level. Engines running hot.");
52+
} else if (fuelLevel > 20000 && engineTemperature <= 2500){
53+
console.log("Full tank. Engines good.");
54+
} else if (fuelLevel > 10000 && engineTemperature <= 2500){
55+
console.log("Fuel level above 50%. Engines good.");
56+
} else if (fuelLevel > 5000 && engineTemperature <= 2500){
57+
console.log("Fuel level above 25%. Engines good.");
58+
} else {
59+
console.log("Fuel and engine status pending...");
60+
}
61+

errors-and-debugging/exercises/Debugging1stSyntaxError.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
//Run this code first and examine the error message.
2-
//Fix the syntax error then run the code again to check your work.
3-
41
let launchReady = false;
52
let fuelLevel = 17000;
63

7-
if (fuelLevel >= 20000 {
4+
if (fuelLevel >= 20000) {
85
console.log('Fuel level cleared.');
96
launchReady = true;
107
} else {

errors-and-debugging/exercises/DebuggingLogicErrors2.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if (fuelLevel >= 20000) {
1616
console.log('WARNING: Insufficient fuel!');
1717
launchReady = false;
1818
}
19+
console.log(launchReady)
1920

2021
// if (crewStatus && computerStatus === 'green'){
2122
// console.log('Crew & computer cleared.');

errors-and-debugging/exercises/DebuggingLogicErrors3.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if (crewStatus && computerStatus === 'green'){
2525
console.log('WARNING: Crew or computer not ready!');
2626
launchReady = false;
2727
}
28+
console.log(launchReady)
2829

2930
// if (launchReady) {
3031
// console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...');

errors-and-debugging/exercises/DebuggingLogicErrors5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ if (crewStatus && computerStatus === 'green'){
2525
launchReady = false;
2626
}
2727

28-
console.log("launchReady = ", launchReady);
28+
console.log("crewReady = ", crewReady);

errors-and-debugging/exercises/DebuggingRuntimeErrors1.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
//Run this code first and examine the error message.
2-
//Pay close attention to any line numbers mentioned in the message - these will help locate and repair the mistake in the code.
3-
41
let launchReady = false;
52
let fuelLevel = 17000;
63

7-
if (fuellevel >= 20000) {
4+
if (fuelLevel >= 20000) {
85
console.log('Fuel level cleared.');
96
launchReady = true;
107
} else {

errors-and-debugging/exercises/DebuggingRuntimeErrors2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (launchReady) {
1414
console.log("Fed parrot...");
1515
console.log("6, 5, 4...");
1616
console.log("Ignition...");
17-
consoul.log("3, 2, 1...");
17+
console.log("3, 2, 1...");
1818
console.log("Liftoff!");
1919
} else {
2020
console.log("Launch scrubbed.");

errors-and-debugging/exercises/DebuggingSyntaxErrors2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let launchReady = false;
88
let crewStatus = true;
99
let computerStatus = 'green';
1010

11-
if (crewStatus &&& computerStatus === 'green'){
11+
if (crewStatus && computerStatus === 'green'){
1212
console.log('Crew & computer cleared.');
1313
launchReady = true;
1414
} else {
@@ -17,7 +17,7 @@ if (crewStatus &&& computerStatus === 'green'){
1717
}
1818

1919
if (launchReady) {
20-
console.log(("10, 9, 8, 7, 6, 5, 4, 3, 2, 1...");
20+
console.log("10, 9, 8, 7, 6, 5, 4, 3, 2, 1...");
2121
console.log("Fed parrot...");
2222
console.log("Ignition...");
2323
console.log("Liftoff!");

0 commit comments

Comments
 (0)