From 696dbdea0d2edad0fa033dadc2618196b92ccf98 Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Wed, 24 Apr 2024 17:22:39 -0500 Subject: [PATCH 1/6] data and variables exercise --- .../exercises/data-and-variables-exercises.js | 25 ++++++++++++++----- .../exercises/package-lock.json | 6 +++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 data-and-variables/exercises/package-lock.json diff --git a/data-and-variables/exercises/data-and-variables-exercises.js b/data-and-variables/exercises/data-and-variables-exercises.js index 6433bcd641..3e20b66ca6 100644 --- a/data-and-variables/exercises/data-and-variables-exercises.js +++ b/data-and-variables/exercises/data-and-variables-exercises.js @@ -1,11 +1,24 @@ // Declare and assign the variables below - +let shuttleName = "Determination"; +let shuttleSpeedMph = 17500; +let distanceToMarsKm = 225000000; +let distanceToMoonKm = 38400; +const milesPerKm = 0.621; // Use console.log to print the 'typeof' each variable. Print one item per line. - +console.log(typeof shuttleName); +console.log(typeof shuttleSpeedMph); +console.log(typeof distanceToMarsKm); +console.log(typeof distanceToMoonKm); +console.log(typeof milesPerKm); // Calculate a space mission below - +let milesToMars = distanceToMarsKm * milesPerKm; +let hoursToMars = milesToMars / shuttleSpeedMph; +let daysToMars = hoursToMars / 24; // Print the results of the space mission calculations below - +console.log(shuttleName + "will take " + daysToMars + " days to reach Mars."); // Calculate a trip to the moon below - -// Print the results of the trip to the moon below \ No newline at end of file +let milesToMoon = distanceToMoonKm * milesPerKm; +let hoursToMoon = milesToMoon / shuttleSpeedMph; +let daysToMoon = hoursToMoon / 24; +// Print the results of the trip to the moon below +console.log(shuttleName + "will take" + daysToMoon + "days to reach the Moon.") \ No newline at end of file diff --git a/data-and-variables/exercises/package-lock.json b/data-and-variables/exercises/package-lock.json new file mode 100644 index 0000000000..8f84d79bed --- /dev/null +++ b/data-and-variables/exercises/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "exercises", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From e88488707540ab1fa7ceedf0cc38460087feea0b Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Tue, 30 Apr 2024 19:18:35 -0500 Subject: [PATCH 2/6] booleans and conditionals exercises --- booleans-and-conditionals/exercises/part-1.js | 62 +++++++++++++++++++ booleans-and-conditionals/exercises/part-3.js | 20 ++++++ 2 files changed, 82 insertions(+) diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js index b829140a07..b3363f60dd 100644 --- a/booleans-and-conditionals/exercises/part-1.js +++ b/booleans-and-conditionals/exercises/part-1.js @@ -1,6 +1,17 @@ // Declare and initialize the variables for exercise 1 here: +let engineIndicatorLight = "red blinking"; +let spaceSuitsOn = true; +let shuttleCabinReady = true; +let crewStatus = spaceSuitsOn && shuttleCabinReady; +let computerStatusCode = 200; +let shuttleSpeed = 15000; // BEFORE running the code, predict what will be printed to the console by the following statements: +// engines are off +// Crew Not Ready +// Please stand by. Computer is rebooting. +// Stable speed. + if (engineIndicatorLight === "green") { console.log("engines have started"); @@ -9,3 +20,54 @@ if (engineIndicatorLight === "green") { } else { console.log("engines are off"); } + +if (crewStatus) { + console.log("Crew Ready"); +} else { + console.log("Crew Not Ready"); +} + +if (computerStatusCode === 200) { + console.log("Please stand by. Computer is rebooting."); +} else if (computerStatusCode === 400) { + console.log("Success! Computer online."); +} else { + console.log("ALERT: Computer offline!"); +} + +if (shuttleSpeed > 17500) { + console.log("ALERT: Escape velocity reached!"); +} else if (shuttleSpeed < 8000) { + console.log("ALERT: Cannot maintain orbit!"); +} else { + console.log("Stable speed"); +} + +if (crewStatus && computerStatusCode === 200 && spaceSuitsOn) { + console.log("all systems go"); +} else { + console.log("WARNING. Not ready"); +} + +if (crew Status || computerStatusCode !== 200 || !spaceSuitsOn) { + console.log("WARNING. Not ready"); +} else { + console.log("all systems go"); +} + +let fuelLevel = 18000; +let engineTemperature = 2500; + +if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){ + console.log("ENGINE FAILURE IMMINENT!"); +} else if (fuelLevel <= 5000 || engineTemperature > 2500){ + console.log("Check fuel level. Engines running hot."); +} else if (fuelLevel > 20000 && engineTemperature <= 2500){ + console.log("Full tank. Engines good."); +} else if (fuelLevel > 10000 && engineTemperature <= 2500){ + console.log("Fuel level above 50%. Engines good."); +} else if (fuelLevel > 5000 && engineTemperature <= 2500){ + console.log("Fuel level above 25%. Engines good."); +} else { + console.log("Fuel and engine status pending..."); +} diff --git a/booleans-and-conditionals/exercises/part-3.js b/booleans-and-conditionals/exercises/part-3.js index 9ed686d097..3f8b7f5208 100644 --- a/booleans-and-conditionals/exercises/part-3.js +++ b/booleans-and-conditionals/exercises/part-3.js @@ -18,7 +18,27 @@ f) Otherwise, print "Fuel and engine status pending..." */ // Code 5a - 5f here: +if (fuelLevel > 20000 && engineTemperature <= 2500) { + console.log("Full tank. Engines good.") +} else if (fuelLevel > 10000 && engineTemperature <= 2500) { + console.log("Fuel level above 50%. Engines good."); +} else if (fuelLevel > 5000 && engineTemperature <= 2500) { + console.log("Fuel above 25%. Engines good."); +} else if (fuelLevel <= 5000 || engineTemperature > 2500) { + console.log("Check fuel level. Engines running hot."); +} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { + console.log("ENGINE FAILURE IMMINENT!"); +} else { + console.log("Fuel and engine status pending..."); +} + // 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. /* 6) b) Code the following if/else check: If fuelLevel is above 20000 AND engineIndicatorLight is NOT red blinking OR commandOverride is true print "Cleared to launch!" Else print "Launch scrubbed!" */ +let commandOverride = false +if (fuelLevel > 20000 && engineIndicatorLight != "red blinking" || commandOverride === true) { + console.log("Cleared to launch!"); +} else { + console.log("Launch scrubbed!"); +} \ No newline at end of file From 20d7aeaa0595e8974aee6e178f0b7d71af5dafd4 Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Wed, 1 May 2024 18:24:47 -0500 Subject: [PATCH 3/6] finished exercises --- booleans-and-conditionals/exercises/part-1.js | 92 ++++++------------- booleans-and-conditionals/exercises/part-2.js | 24 ++++- booleans-and-conditionals/exercises/part-3.js | 44 ++++----- 3 files changed, 71 insertions(+), 89 deletions(-) diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js index b3363f60dd..37e39a67dc 100644 --- a/booleans-and-conditionals/exercises/part-1.js +++ b/booleans-and-conditionals/exercises/part-1.js @@ -1,10 +1,10 @@ // Declare and initialize the variables for exercise 1 here: -let engineIndicatorLight = "red blinking"; -let spaceSuitsOn = true; -let shuttleCabinReady = true; -let crewStatus = spaceSuitsOn && shuttleCabinReady; -let computerStatusCode = 200; -let shuttleSpeed = 15000; +//let engineIndicatorLight = "red blinking"; +//let spaceSuitsOn = true; +//let shuttleCabinReady = true; +//let crewStatus = spaceSuitsOn && shuttleCabinReady; +//let computerStatusCode = 200; +//let shuttleSpeed = 15000; // BEFORE running the code, predict what will be printed to the console by the following statements: // engines are off @@ -13,61 +13,27 @@ let shuttleSpeed = 15000; // Stable speed. -if (engineIndicatorLight === "green") { - console.log("engines have started"); -} else if (engineIndicatorLight === "green blinking") { - console.log("engines are preparing to start"); -} else { - console.log("engines are off"); -} - -if (crewStatus) { - console.log("Crew Ready"); -} else { - console.log("Crew Not Ready"); -} - -if (computerStatusCode === 200) { - console.log("Please stand by. Computer is rebooting."); -} else if (computerStatusCode === 400) { - console.log("Success! Computer online."); -} else { - console.log("ALERT: Computer offline!"); -} - -if (shuttleSpeed > 17500) { - console.log("ALERT: Escape velocity reached!"); -} else if (shuttleSpeed < 8000) { - console.log("ALERT: Cannot maintain orbit!"); -} else { - console.log("Stable speed"); -} - -if (crewStatus && computerStatusCode === 200 && spaceSuitsOn) { - console.log("all systems go"); -} else { - console.log("WARNING. Not ready"); -} - -if (crew Status || computerStatusCode !== 200 || !spaceSuitsOn) { - console.log("WARNING. Not ready"); -} else { - console.log("all systems go"); -} +//if (engineIndicatorLight === "green") { + // console.log("engines have started"); +//} else if (engineIndicatorLight === "green blinking") { + // console.log("engines are preparing to start"); +//} else { + // console.log("engines are off"); +//} -let fuelLevel = 18000; -let engineTemperature = 2500; - -if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){ - console.log("ENGINE FAILURE IMMINENT!"); -} else if (fuelLevel <= 5000 || engineTemperature > 2500){ - console.log("Check fuel level. Engines running hot."); -} else if (fuelLevel > 20000 && engineTemperature <= 2500){ - console.log("Full tank. Engines good."); -} else if (fuelLevel > 10000 && engineTemperature <= 2500){ - console.log("Fuel level above 50%. Engines good."); -} else if (fuelLevel > 5000 && engineTemperature <= 2500){ - console.log("Fuel level above 25%. Engines good."); -} else { - console.log("Fuel and engine status pending..."); -} +//let fuelLevel = 18000; +//let engineTemperature = 2500; + +//if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){ + // console.log("ENGINE FAILURE IMMINENT!"); +//} else if (fuelLevel <= 5000 || engineTemperature > 2500){ + // console.log("Check fuel level. Engines running hot."); +//} else if (fuelLevel > 20000 && engineTemperature <= 2500){ + // console.log("Full tank. Engines good."); +//} else if (fuelLevel > 10000 && engineTemperature <= 2500){ + // console.log("Fuel level above 50%. Engines good."); +//} else if (fuelLevel > 5000 && engineTemperature <= 2500){ + // console.log("Fuel level above 25%. Engines good."); +//} else { + // console.log("Fuel and engine status pending..."); +//} diff --git a/booleans-and-conditionals/exercises/part-2.js b/booleans-and-conditionals/exercises/part-2.js index ff11fbab8a..61bb8d508a 100644 --- a/booleans-and-conditionals/exercises/part-2.js +++ b/booleans-and-conditionals/exercises/part-2.js @@ -8,14 +8,30 @@ let shuttleSpeed = 15000; // 3) Write conditional expressions to satisfy the following safety rules: // a) If crewStatus is true, print "Crew Ready" else print "Crew Not Ready". - +if (crewStatus === true) { + console.log("Crew Ready."); +} else { + console.log("Crew Not Ready.") +} // 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!" - +if (computerStatusCode === 200) { + console.log("Please stand by. Computer is rebooting."); +} else if (computerStatusCode === 400) { + console.log("Success! Comouter online."); +} else { + console.log("ALERT: Computer offline!"); +} // 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". - +if (shuttleSpeed > 17500) { + console.log("ALERT: Escape velocity reached!"); +} else if (shuttleSpeed < 8000) { + console.log("ALERT: Cannot maintain orbit!"); +} else { + console.log("Stable speed."); +} // 4) PREDICT: Do the code blocks shown in the 'predict.txt' file produce the same result? -console.log(/* "Yes" or "No" */); +console.log("Yes"); diff --git a/booleans-and-conditionals/exercises/part-3.js b/booleans-and-conditionals/exercises/part-3.js index 3f8b7f5208..1b5a8973dc 100644 --- a/booleans-and-conditionals/exercises/part-3.js +++ b/booleans-and-conditionals/exercises/part-3.js @@ -1,6 +1,6 @@ -let engineIndicatorLight = 'red blinking'; -let fuelLevel = 21000; -let engineTemperature = 1200; +//let engineIndicatorLight = 'red blinking'; +//let fuelLevel = 21000; +//let engineTemperature = 1200; /* 5) Implement the following checks using if/else if/else statements: @@ -18,27 +18,27 @@ f) Otherwise, print "Fuel and engine status pending..." */ // Code 5a - 5f here: -if (fuelLevel > 20000 && engineTemperature <= 2500) { - console.log("Full tank. Engines good.") -} else if (fuelLevel > 10000 && engineTemperature <= 2500) { - console.log("Fuel level above 50%. Engines good."); -} else if (fuelLevel > 5000 && engineTemperature <= 2500) { - console.log("Fuel above 25%. Engines good."); -} else if (fuelLevel <= 5000 || engineTemperature > 2500) { - console.log("Check fuel level. Engines running hot."); -} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { - console.log("ENGINE FAILURE IMMINENT!"); -} else { - console.log("Fuel and engine status pending..."); -} +//if (fuelLevel > 20000 && engineTemperature <= 2500) { + // console.log("Full tank. Engines good.") +//} else if (fuelLevel > 10000 && engineTemperature <= 2500) { + // console.log("Fuel level above 50%. Engines good."); +//} else if (fuelLevel > 5000 && engineTemperature <= 2500) { + // console.log("Fuel above 25%. Engines good.");/ +//} else if (fuelLevel <= 5000 || engineTemperature > 2500) { + // console.log("Check fuel level. Engines running hot."); +//} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { + // console.log("ENGINE FAILURE IMMINENT!"); +//} else { + // console.log("Fuel and engine status pending..."); +//} // 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. /* 6) b) Code the following if/else check: If fuelLevel is above 20000 AND engineIndicatorLight is NOT red blinking OR commandOverride is true print "Cleared to launch!" Else print "Launch scrubbed!" */ -let commandOverride = false -if (fuelLevel > 20000 && engineIndicatorLight != "red blinking" || commandOverride === true) { - console.log("Cleared to launch!"); -} else { - console.log("Launch scrubbed!"); -} \ No newline at end of file +//let commandOverride = false +//if (fuelLevel > 20000 && engineIndicatorLight != "red blinking" || commandOverride === true) { + // console.log("Cleared to launch!"); +//} else { + // console.log("Launch scrubbed!"); +//} \ No newline at end of file From d7dd52a5bff21ba6d9844b22ee98d4df11394ab5 Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Wed, 1 May 2024 18:29:03 -0500 Subject: [PATCH 4/6] finished exercises final --- booleans-and-conditionals/exercises/part-1.js | 56 +++++++++---------- booleans-and-conditionals/exercises/part-3.js | 44 +++++++-------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js index 37e39a67dc..427e629f3b 100644 --- a/booleans-and-conditionals/exercises/part-1.js +++ b/booleans-and-conditionals/exercises/part-1.js @@ -1,10 +1,10 @@ // Declare and initialize the variables for exercise 1 here: -//let engineIndicatorLight = "red blinking"; -//let spaceSuitsOn = true; -//let shuttleCabinReady = true; -//let crewStatus = spaceSuitsOn && shuttleCabinReady; -//let computerStatusCode = 200; -//let shuttleSpeed = 15000; +let engineIndicatorLight = "red blinking"; +let spaceSuitsOn = true; +let shuttleCabinReady = true; +let crewStatus = spaceSuitsOn && shuttleCabinReady; +let computerStatusCode = 200; +let shuttleSpeed = 15000; // BEFORE running the code, predict what will be printed to the console by the following statements: // engines are off @@ -13,27 +13,27 @@ // Stable speed. -//if (engineIndicatorLight === "green") { - // console.log("engines have started"); -//} else if (engineIndicatorLight === "green blinking") { - // console.log("engines are preparing to start"); -//} else { - // console.log("engines are off"); -//} +if (engineIndicatorLight === "green") { + console.log("engines have started"); +} else if (engineIndicatorLight === "green blinking") { + console.log("engines are preparing to start"); +} else { + console.log("engines are off"); +} -//let fuelLevel = 18000; -//let engineTemperature = 2500; +let fuelLevel = 18000; +let engineTemperature = 2500; -//if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){ - // console.log("ENGINE FAILURE IMMINENT!"); -//} else if (fuelLevel <= 5000 || engineTemperature > 2500){ - // console.log("Check fuel level. Engines running hot."); -//} else if (fuelLevel > 20000 && engineTemperature <= 2500){ - // console.log("Full tank. Engines good."); -//} else if (fuelLevel > 10000 && engineTemperature <= 2500){ - // console.log("Fuel level above 50%. Engines good."); -//} else if (fuelLevel > 5000 && engineTemperature <= 2500){ - // console.log("Fuel level above 25%. Engines good."); -//} else { - // console.log("Fuel and engine status pending..."); -//} +if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking"){ + console.log("ENGINE FAILURE IMMINENT!"); +} else if (fuelLevel <= 5000 || engineTemperature > 2500){ + console.log("Check fuel level. Engines running hot."); +} else if (fuelLevel > 20000 && engineTemperature <= 2500){ + console.log("Full tank. Engines good."); +} else if (fuelLevel > 10000 && engineTemperature <= 2500){ + console.log("Fuel level above 50%. Engines good."); +} else if (fuelLevel > 5000 && engineTemperature <= 2500){ + console.log("Fuel level above 25%. Engines good."); +} else { + console.log("Fuel and engine status pending..."); +} diff --git a/booleans-and-conditionals/exercises/part-3.js b/booleans-and-conditionals/exercises/part-3.js index 1b5a8973dc..3f8b7f5208 100644 --- a/booleans-and-conditionals/exercises/part-3.js +++ b/booleans-and-conditionals/exercises/part-3.js @@ -1,6 +1,6 @@ -//let engineIndicatorLight = 'red blinking'; -//let fuelLevel = 21000; -//let engineTemperature = 1200; +let engineIndicatorLight = 'red blinking'; +let fuelLevel = 21000; +let engineTemperature = 1200; /* 5) Implement the following checks using if/else if/else statements: @@ -18,27 +18,27 @@ f) Otherwise, print "Fuel and engine status pending..." */ // Code 5a - 5f here: -//if (fuelLevel > 20000 && engineTemperature <= 2500) { - // console.log("Full tank. Engines good.") -//} else if (fuelLevel > 10000 && engineTemperature <= 2500) { - // console.log("Fuel level above 50%. Engines good."); -//} else if (fuelLevel > 5000 && engineTemperature <= 2500) { - // console.log("Fuel above 25%. Engines good.");/ -//} else if (fuelLevel <= 5000 || engineTemperature > 2500) { - // console.log("Check fuel level. Engines running hot."); -//} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { - // console.log("ENGINE FAILURE IMMINENT!"); -//} else { - // console.log("Fuel and engine status pending..."); -//} +if (fuelLevel > 20000 && engineTemperature <= 2500) { + console.log("Full tank. Engines good.") +} else if (fuelLevel > 10000 && engineTemperature <= 2500) { + console.log("Fuel level above 50%. Engines good."); +} else if (fuelLevel > 5000 && engineTemperature <= 2500) { + console.log("Fuel above 25%. Engines good."); +} else if (fuelLevel <= 5000 || engineTemperature > 2500) { + console.log("Check fuel level. Engines running hot."); +} else if (fuelLevel < 1000 || engineTemperature > 3500 || engineIndicatorLight === "red blinking") { + console.log("ENGINE FAILURE IMMINENT!"); +} else { + console.log("Fuel and engine status pending..."); +} // 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. /* 6) b) Code the following if/else check: If fuelLevel is above 20000 AND engineIndicatorLight is NOT red blinking OR commandOverride is true print "Cleared to launch!" Else print "Launch scrubbed!" */ -//let commandOverride = false -//if (fuelLevel > 20000 && engineIndicatorLight != "red blinking" || commandOverride === true) { - // console.log("Cleared to launch!"); -//} else { - // console.log("Launch scrubbed!"); -//} \ No newline at end of file +let commandOverride = false +if (fuelLevel > 20000 && engineIndicatorLight != "red blinking" || commandOverride === true) { + console.log("Cleared to launch!"); +} else { + console.log("Launch scrubbed!"); +} \ No newline at end of file From 2afa3c4ee71f01c5bd02da3a4300d49807cfd2ac Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Thu, 2 May 2024 09:49:48 -0500 Subject: [PATCH 5/6] finished errors and debugging exercise --- .../exercises/Debugging1stSyntaxError.js | 2 +- .../exercises/DebuggingLogicErrors2.js | 1 + .../exercises/DebuggingLogicErrors3.js | 1 + .../exercises/DebuggingLogicErrors5.js | 14 +++++++++++--- .../exercises/DebuggingRuntimeErrors1.js | 2 +- .../exercises/DebuggingRuntimeErrors2.js | 2 +- .../exercises/DebuggingSyntaxErrors2.js | 4 ++-- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/errors-and-debugging/exercises/Debugging1stSyntaxError.js b/errors-and-debugging/exercises/Debugging1stSyntaxError.js index 365af5a964..f35a8c49d2 100644 --- a/errors-and-debugging/exercises/Debugging1stSyntaxError.js +++ b/errors-and-debugging/exercises/Debugging1stSyntaxError.js @@ -4,7 +4,7 @@ let launchReady = false; let fuelLevel = 17000; -if (fuelLevel >= 20000 { +if (fuelLevel >= 20000) { console.log('Fuel level cleared.'); launchReady = true; } else { diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors2.js b/errors-and-debugging/exercises/DebuggingLogicErrors2.js index 160a0c2cd0..b7b59c7682 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors2.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors2.js @@ -16,6 +16,7 @@ if (fuelLevel >= 20000) { console.log('WARNING: Insufficient fuel!'); launchReady = false; } +console.log(launchReady); // if (crewStatus && computerStatus === 'green'){ // console.log('Crew & computer cleared.'); diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors3.js b/errors-and-debugging/exercises/DebuggingLogicErrors3.js index 023f2ab07d..0ba6e61d76 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors3.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors3.js @@ -25,6 +25,7 @@ if (crewStatus && computerStatus === 'green'){ console.log('WARNING: Crew or computer not ready!'); launchReady = false; } +console.log(launchReady); // if (launchReady) { // console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...'); diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors5.js b/errors-and-debugging/exercises/DebuggingLogicErrors5.js index 7eb908e769..adf204bbe8 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors5.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors5.js @@ -3,6 +3,7 @@ // Refactor the code to do this. Verify that your change works by updating the console.log statements. let launchReady = false; +let crewReady = false; let fuelLevel = 17000; let crewStatus = true; let computerStatus = 'green'; @@ -19,10 +20,17 @@ console.log("launchReady = ", launchReady); if (crewStatus && computerStatus === 'green'){ console.log('Crew & computer cleared.'); - launchReady = true; + crewReady = true; } else { console.log('WARNING: Crew or computer not ready!'); - launchReady = false; + crewReady = false; } -console.log("launchReady = ", launchReady); \ No newline at end of file +console.log("crewReady = ", crewReady); + +if (launchReady) { + console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...'); + console.log('Liftoff!'); +} else { + console.log('Launch scrubbed.'); +} diff --git a/errors-and-debugging/exercises/DebuggingRuntimeErrors1.js b/errors-and-debugging/exercises/DebuggingRuntimeErrors1.js index e66e494a30..7bbf7ebb82 100644 --- a/errors-and-debugging/exercises/DebuggingRuntimeErrors1.js +++ b/errors-and-debugging/exercises/DebuggingRuntimeErrors1.js @@ -4,7 +4,7 @@ let launchReady = false; let fuelLevel = 17000; -if (fuellevel >= 20000) { +if (fuelLevel >= 20000) { console.log('Fuel level cleared.'); launchReady = true; } else { diff --git a/errors-and-debugging/exercises/DebuggingRuntimeErrors2.js b/errors-and-debugging/exercises/DebuggingRuntimeErrors2.js index a656080d25..703a0d61c4 100644 --- a/errors-and-debugging/exercises/DebuggingRuntimeErrors2.js +++ b/errors-and-debugging/exercises/DebuggingRuntimeErrors2.js @@ -14,7 +14,7 @@ if (launchReady) { console.log("Fed parrot..."); console.log("6, 5, 4..."); console.log("Ignition..."); - consoul.log("3, 2, 1..."); + console.log("3, 2, 1..."); console.log("Liftoff!"); } else { console.log("Launch scrubbed."); diff --git a/errors-and-debugging/exercises/DebuggingSyntaxErrors2.js b/errors-and-debugging/exercises/DebuggingSyntaxErrors2.js index b600339254..daf36e5da5 100644 --- a/errors-and-debugging/exercises/DebuggingSyntaxErrors2.js +++ b/errors-and-debugging/exercises/DebuggingSyntaxErrors2.js @@ -8,7 +8,7 @@ let launchReady = false; let crewStatus = true; let computerStatus = 'green'; -if (crewStatus &&& computerStatus === 'green'){ +if (crewStatus && computerStatus === 'green'){ console.log('Crew & computer cleared.'); launchReady = true; } else { @@ -17,7 +17,7 @@ if (crewStatus &&& computerStatus === 'green'){ } if (launchReady) { - console.log(("10, 9, 8, 7, 6, 5, 4, 3, 2, 1..."); + console.log("10, 9, 8, 7, 6, 5, 4, 3, 2, 1..."); console.log("Fed parrot..."); console.log("Ignition..."); console.log("Liftoff!"); From 46956d5c0b80365335fc4a5323a8d5d06ae66c31 Mon Sep 17 00:00:00 2001 From: Ashley Dougherty Date: Thu, 2 May 2024 20:04:49 -0500 Subject: [PATCH 6/6] studio shuttle launch --- .../studio/data-variables-conditionals.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/booleans-and-conditionals/studio/data-variables-conditionals.js b/booleans-and-conditionals/studio/data-variables-conditionals.js index 6a15e146f4..7677eb2c83 100644 --- a/booleans-and-conditionals/studio/data-variables-conditionals.js +++ b/booleans-and-conditionals/studio/data-variables-conditionals.js @@ -1,15 +1,50 @@ // Initialize Variables below +const date = "Monday 2019-03-18" +const time = "10:05:34 AM" +const astronautCount = 7 +const astronautStatus = "ready" +const averageAstronautMassKg = 80.7 +const crewMassKg = (astronautCount * averageAstronautMassKg) +const fuelMassKg = 760000 +const shuttleMassKg = 74842.31 +const totalMassKg = (crewMassKg + fuelMassKg + shuttleMassKg) +const maximumMassLimit = 850000 +const fuelTempCelcius = -225 +const minimumFuelTemp = -300 +const maximumFuelTemp = -150 +let fuelLevel = "100%" +let weatherStatus = "clear" +let preparedForLiftOff = true // add logic below to verify total number of astronauts for shuttle launch does not exceed 7 +if (astronautCount <= 7); // add logic below to verify all astronauts are ready +if (astronautStatus === "ready"); // add logic below to verify the total mass does not exceed the maximum limit of 850000 +if (totalMassKg < maximumMassLimit); // add logic below to verify the fuel temperature is within the appropriate range of -150 and -300 +if (fuelTempCelcius >= minimumFuelTemp || maximumFuelTemp); // add logic below to verify the fuel level is at 100% +if (fuelLevel === "100%"); // add logic below to verify the weather status is clear +if (weatherStatus === "clear"){ + console.log("All systems are a go! Initiating space shuttle launch sequence."); +} // Verify shuttle launch can proceed based on above conditions +console.log("date: " + date); +console.log("time: " + time); +console.log("Astronaut Count: " + astronautCount); +console.log("Crew Mass: " + crewMassKg + " kg"); +console.log("Fuel Mass: " + fuelMassKg + " kg"); +console.log("Shuttle Mass: " + shuttleMassKg + " kg"); +console.log("Total Mass: " + totalMassKg + " kg"); +console.log("Fuel Temperature: " + fuelTempCelcius + " C"); +console.log("Weather Status: " + weatherStatus); + +console.log("Have a safe trip astronauts!")