From 18f96f77366bb1ab0adfa35611d55098ca872140 Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Sat, 3 Aug 2024 01:05:57 -0500 Subject: [PATCH 1/7] Data and Variables Exercise Completed --- .../exercises/data-and-variables-exercises.js | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/data-and-variables/exercises/data-and-variables-exercises.js b/data-and-variables/exercises/data-and-variables-exercises.js index 6433bcd641..54b110e492 100644 --- a/data-and-variables/exercises/data-and-variables-exercises.js +++ b/data-and-variables/exercises/data-and-variables-exercises.js @@ -1,11 +1,25 @@ // Declare and assign the variables below +let shuttleName = "Determination"; +let shuttleSpeed = 17500; +let distanceToMars = 225000000; +let distanceToTheMoon = 384400; +let milesPerKm = 0.621; // Use console.log to print the 'typeof' each variable. Print one item per line. - +console.log(typeof shuttleName); +console.log(typeof shuttleSpeed); +console.log(typeof distanceToMars); +console.log(typeof distanceToTheMoon); +console.log(typeof milesPerKm); // Calculate a space mission below - +let milesToMars = (distanceToMars * milesPerKm); +let hoursToMars = (milesToMars / shuttleSpeed); +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 = (distanceToTheMoon * milesPerKm); +let hoursToMoon = (milesToMoon / shuttleSpeed); +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."); From a3935132c54855791905b82c7ed805af0ad36418 Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Sun, 6 Oct 2024 23:02:53 -0500 Subject: [PATCH 2/7] Worked on Debugging exercises --- booleans-and-conditionals/exercises/part-1.js | 7 +++++- booleans-and-conditionals/exercises/part-2.js | 22 ++++++++++++++++--- booleans-and-conditionals/exercises/part-3.js | 10 ++++++++- .../exercises/Debugging1stSyntaxError.js | 2 +- .../exercises/DebuggingLogicErrors2.js | 2 +- .../exercises/DebuggingLogicErrors3.js | 4 ++-- .../exercises/DebuggingLogicErrors4.js | 2 +- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js index b829140a07..392bceca90 100644 --- a/booleans-and-conditionals/exercises/part-1.js +++ b/booleans-and-conditionals/exercises/part-1.js @@ -1,5 +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; // BEFORE running the code, predict what will be printed to the console by the following statements: if (engineIndicatorLight === "green") { diff --git a/booleans-and-conditionals/exercises/part-2.js b/booleans-and-conditionals/exercises/part-2.js index ff11fbab8a..a7edfc782d 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! Computer 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 9ed686d097..9585133e28 100644 --- a/booleans-and-conditionals/exercises/part-3.js +++ b/booleans-and-conditionals/exercises/part-3.js @@ -17,7 +17,15 @@ e) If fuelLevel is below 1000 OR engineTemperature is above 3500 OR engineIndica 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 level 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) // 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: 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..75a47005a8 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors2.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors2.js @@ -16,7 +16,7 @@ if (fuelLevel >= 20000) { console.log('WARNING: Insufficient fuel!'); launchReady = false; } - +//It should be false // if (crewStatus && computerStatus === 'green'){ // console.log('Crew & computer cleared.'); // launchReady = true; diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors3.js b/errors-and-debugging/exercises/DebuggingLogicErrors3.js index 023f2ab07d..d3b2f7e3cc 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors3.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors3.js @@ -1,4 +1,4 @@ -// Let’s break the code down into smaller chunks. +``// Let’s break the code down into smaller chunks. // Now consider the second if/else block. // Add another console.log(launchReady) after this block and run the program. @@ -25,7 +25,7 @@ if (crewStatus && computerStatus === 'green'){ console.log('WARNING: Crew or computer not ready!'); launchReady = false; } - +//It should be true // if (launchReady) { // console.log('10, 9, 8, 7, 6, 5, 4, 3, 2, 1...'); // console.log('Liftoff!'); diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors4.js b/errors-and-debugging/exercises/DebuggingLogicErrors4.js index dc9ac0af9d..208ab0e417 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors4.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors4.js @@ -26,7 +26,7 @@ if (crewStatus && computerStatus === 'green'){ console.log('WARNING: Crew or computer not ready!'); launchReady = false; } - +//No matter what the fuel was doing it would set launch ready if the crew and computer were correct console.log("launchReady = ", launchReady); // if (launchReady) { From 70bf19f310298650989521fb418ed8fc6aeebe7e Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Mon, 7 Oct 2024 11:09:28 -0500 Subject: [PATCH 3/7] Worked on Debugging 5 exercises --- errors-and-debugging/exercises/DebuggingLogicErrors5.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors5.js b/errors-and-debugging/exercises/DebuggingLogicErrors5.js index 7eb908e769..2676964d61 100644 --- a/errors-and-debugging/exercises/DebuggingLogicErrors5.js +++ b/errors-and-debugging/exercises/DebuggingLogicErrors5.js @@ -6,6 +6,7 @@ let launchReady = false; let fuelLevel = 17000; let crewStatus = true; let computerStatus = 'green'; +let utilitiesReady = false; if (fuelLevel >= 20000) { console.log('Fuel level cleared.'); @@ -19,10 +20,10 @@ console.log("launchReady = ", launchReady); if (crewStatus && computerStatus === 'green'){ console.log('Crew & computer cleared.'); - launchReady = true; + utilitiesReady = true; } else { console.log('WARNING: Crew or computer not ready!'); - launchReady = false; + utilitiesReady = false; } -console.log("launchReady = ", launchReady); \ No newline at end of file +console.log("utilitiesReady = ", utilitiesReady); \ No newline at end of file From 34b18519026e1b0c31e9f128f531b2bfa1570d9d Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Mon, 7 Oct 2024 11:09:36 -0500 Subject: [PATCH 4/7] Worked on Debugging 5 exercises --- .idea/.gitignore | 3 +++ .idea/javascript-projects.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ 5 files changed, 32 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/javascript-projects.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000..26d33521af --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/javascript-projects.iml b/.idea/javascript-projects.iml new file mode 100644 index 0000000000..d6ebd48059 --- /dev/null +++ b/.idea/javascript-projects.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..69ace3f6af --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..fa44cea7f9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..35eb1ddfbb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 91d675f496d2076e7f99b5c20e2afd6c533cc772 Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Mon, 7 Oct 2024 11:10:52 -0500 Subject: [PATCH 5/7] Worked on Debugging Runtime Errors 1 exercises --- errors-and-debugging/exercises/DebuggingRuntimeErrors1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From a05da69aca3d2026d5fe5b88c55753bf8246cadc Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Mon, 7 Oct 2024 11:12:06 -0500 Subject: [PATCH 6/7] Worked on Debugging Runtime Errors 2 exercises, one of the console.logs was spelled incorrectly --- errors-and-debugging/exercises/DebuggingRuntimeErrors2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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."); From bd26a670836a7d2f7f2008abf0401392f4a73348 Mon Sep 17 00:00:00 2001 From: Pj Elliott Date: Mon, 7 Oct 2024 11:17:37 -0500 Subject: [PATCH 7/7] Worked on Debugging Syntax Errors 2, it had 2 many &&& instead of && and one of the console logs had an extra ( --- errors-and-debugging/exercises/DebuggingSyntaxErrors2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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!");