]: ';
+ }
+ display += query;
+ }
+
+ return key2i[exports.keyIn(display, readOptions).toLowerCase()];
+};
+
+exports.getRawInput = function() { return rawInput; };
+
+// ======== DEPRECATED ========
+function _setOption(optionName, args) {
+ var options;
+ if (args.length) { options = {}; options[optionName] = args[0]; }
+ return exports.setDefaultOptions(options)[optionName];
+}
+exports.setPrint = function() { return _setOption('print', arguments); };
+exports.setPrompt = function() { return _setOption('prompt', arguments); };
+exports.setEncoding = function() { return _setOption('encoding', arguments); };
+exports.setMask = function() { return _setOption('mask', arguments); };
+exports.setBufferSize = function() { return _setOption('bufferSize', arguments); };
diff --git a/arrays/studio/node_modules/readline-sync/package.json b/arrays/studio/node_modules/readline-sync/package.json
new file mode 100644
index 0000000000..9b9e3952eb
--- /dev/null
+++ b/arrays/studio/node_modules/readline-sync/package.json
@@ -0,0 +1,68 @@
+{
+ "_from": "readline-sync@1.4.9",
+ "_id": "readline-sync@1.4.9",
+ "_inBundle": false,
+ "_integrity": "sha512-mp5h1N39kuKbCRGebLPIKTBOhuDw55GaNg5S+K9TW9uDAS1wIHpGUc2YokdUMZJb8GqS49sWmWEDijaESYh0Hg==",
+ "_location": "/readline-sync",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "readline-sync@1.4.9",
+ "name": "readline-sync",
+ "escapedName": "readline-sync",
+ "rawSpec": "1.4.9",
+ "saveSpec": null,
+ "fetchSpec": "1.4.9"
+ },
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz",
+ "_shasum": "3eda8e65f23cd2a17e61301b1f0003396af5ecda",
+ "_spec": "readline-sync@1.4.9",
+ "_where": "C:\\Users\\mbbki\\Documents\\GitHub\\javascript-projects\\arrays\\studio",
+ "author": {
+ "name": "anseki",
+ "url": "https://github.com/anseki"
+ },
+ "bugs": {
+ "url": "https://github.com/anseki/readline-sync/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "files": [
+ "lib/*.@(js|ps1|sh)",
+ "LICENSE-MIT",
+ "README-Deprecated.md"
+ ],
+ "homepage": "https://github.com/anseki/readline-sync",
+ "keywords": [
+ "readline",
+ "synchronous",
+ "interactive",
+ "prompt",
+ "question",
+ "password",
+ "cli",
+ "tty",
+ "command",
+ "repl",
+ "keyboard",
+ "wait",
+ "block"
+ ],
+ "license": "MIT",
+ "main": "./lib/readline-sync.js",
+ "name": "readline-sync",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/anseki/readline-sync.git"
+ },
+ "title": "readlineSync",
+ "version": "1.4.9"
+}
diff --git a/arrays/studio/package-lock.json b/arrays/studio/package-lock.json
new file mode 100644
index 0000000000..030c1eb30f
--- /dev/null
+++ b/arrays/studio/package-lock.json
@@ -0,0 +1,11 @@
+{
+ "requires": true,
+ "lockfileVersion": 1,
+ "dependencies": {
+ "readline-sync": {
+ "version": "1.4.9",
+ "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz",
+ "integrity": "sha512-mp5h1N39kuKbCRGebLPIKTBOhuDw55GaNg5S+K9TW9uDAS1wIHpGUc2YokdUMZJb8GqS49sWmWEDijaESYh0Hg=="
+ }
+ }
+}
diff --git a/arrays/studio/string-modification.js b/arrays/studio/string-modification.js
index 45991b15fc..78a800ddf2 100644
--- a/arrays/studio/string-modification.js
+++ b/arrays/studio/string-modification.js
@@ -1,11 +1,22 @@
const input = require('readline-sync');
let str = "LaunchCode";
+let info = input.question("Choose a number of letters to re-arrange");
//1) Use string methods to remove the first three characters from the string and add them to the end.
+let newStr = str.substring(0,3);
+str=str.substring(3);
+str=str.concat(newStr);
+console.log(str);
//Hint - define another variable to hold the new string or reassign the new string to str.
//Use a template literal to print the original and modified string in a descriptive phrase.
//2) Modify your code to accept user input. Query the user to enter the number of letters that will be relocated.
+
+
//3) Add validation to your code to deal with user inputs that are longer than the word. In such cases, default to moving 3 characters. Also, the template literal should note the error.
+if (info >str.length) {
+
+ console.log("Try again!");
+}
\ No newline at end of file
diff --git a/booleans-and-conditionals/exercises/part-1.js b/booleans-and-conditionals/exercises/part-1.js
index b829140a07..92219a03c6 100644
--- a/booleans-and-conditionals/exercises/part-1.js
+++ b/booleans-and-conditionals/exercises/part-1.js
@@ -1,4 +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:
@@ -9,3 +15,39 @@ 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 (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/studio/data-variables-conditionals.js b/booleans-and-conditionals/studio/data-variables-conditionals.js
index 6a15e146f4..5f8a78c897 100644
--- a/booleans-and-conditionals/studio/data-variables-conditionals.js
+++ b/booleans-and-conditionals/studio/data-variables-conditionals.js
@@ -1,15 +1,103 @@
// Initialize Variables below
+let date = "Monday 2019-03-18";
+
+let time = "10:05:34 AM";
+
+let astronautCount = 7;
+
+let astronautStatus = "ready";
+
+let averageAstronautMassKg = 80.7;
+
+crewMassKg = astronautCount*averageAstronautMassKg
+
+fuelMassKg = 760000;
+
+shuttleMassKg = 74842.31;
+
+totalMassKg = crewMassKg + fuelMassKg + shuttleMassKg
+
+maximumMassLimit = 850000;
+
+fuelTempCelsius = -225;
+
+minimumFuelTemp = -300;
+
+maximumFuelTemp = -150;
+
+fuelLevel = "100%";
+
+weatherStatus = "clear";
+
+preparedForLiftOff = true;
+
// add logic below to verify total number of astronauts for shuttle launch does not exceed 7
+if (astronautCount <=7){
+ preparedForLiftOff = true;
+
+} else {
+ preparedForLiftOff = false;
+}
+
// add logic below to verify all astronauts are ready
+if (astronautStatus = "ready" ){
+ preparedForLiftOff = true;
+} else {
+ preparedForLiftOff = false;
+}
// add logic below to verify the total mass does not exceed the maximum limit of 850000
+if (totalMassKg <=maximumMassLimit){
+ preparedForLiftOff = true;
+} else {
+ preparedForLiftOff = false;
+}
// add logic below to verify the fuel temperature is within the appropriate range of -150 and -300
+if ( fuelTempCelsius >= 300 || fuelTempCelsius <= -150 ){
+ preparedForLiftOff = true;
+} else {
+ preparedForLiftOff = false;
+}
// add logic below to verify the fuel level is at 100%
+if ( fuelLevel === "100%"){
+ preparedForLiftOff = true;
+} else {
+ preparedForLiftOff = false;
+}
// add logic below to verify the weather status is clear
+if (weatherStatus === "clear" ){
+ preparedForLiftOff = true;
+} else {
+ preparedForLiftOff = false;
+}
// Verify shuttle launch can proceed based on above conditions
+if (preparedForLiftOff === true ){
+ preparedForLiftOff = true;
+
+} else {
+ preparedForLiftOff = false;
+}
+
+let banner = ("---------------------------------------");
+let headline = ("All systems are a go! Initializing space shuttle launch sequence");
+let closingMessage = ("Have a safe trip astronauts!" );
+if (preparedForLiftOff = true){
+ console.log(headline);
+ console.log(banner);
+ 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"+fuelTempCelsius+ "C");
+ console.log("Weather Status:"+weatherStatus);
+ console.log(banner);
+}
diff --git a/classes/exercises/ClassExercises.js b/classes/exercises/ClassExercises.js
index 91b9ee5b9d..56a5bb220f 100644
--- a/classes/exercises/ClassExercises.js
+++ b/classes/exercises/ClassExercises.js
@@ -1,10 +1,48 @@
// Define your Book class here:
+class Book {
+ constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
+ this.title = title;
+ this.author = author;
+ this.copyright = copyright;
+ this.isbn = isbn;
+ this.pages = pages;
+ this.timesCheckedOut = timesCheckedOut;
+ this.discarded = discarded;
+ }
+ checkout(uses=1) {
+ this.timesCheckedOut += uses;
+ }
+}
+
+class Manual extends Book {
+ constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
+ super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
+ }
+
+ dispose(currentYear){
+ if (currentYear-this.copyright > 5) {
+ this.discarded = 'Yes';
+ }
+ }
+}
+
+class Novel extends Book {
+ constructor(title, author, copyright, isbn, pages, timesCheckedOut, discarded){
+ super(title, author, copyright, isbn, pages, timesCheckedOut, discarded);
+ }
+
+ dispose(){
+ if (this.timesCheckedOut > 100) {
+ this.discarded = 'Yes';
+ }
+ }
+}
// Define your Manual and Novel classes here:
// Declare the objects for exercises 2 and 3 here:
-
+let makingTheShip = new Manual('Top Secret Shuttle Building Manual', 'Redacted', 2013, '0000000000000', 1147, 1, 'No');
// Code exercises 4 & 5 here:
\ No newline at end of file
diff --git a/classes/studio/ClassStudio.js b/classes/studio/ClassStudio.js
index c3a6152140..b78a6e7b6c 100644
--- a/classes/studio/ClassStudio.js
+++ b/classes/studio/ClassStudio.js
@@ -1,9 +1,56 @@
//Declare a class called CrewCandidate with a constructor that takes three parameters—name, mass, and scores. Note that scores will be an array of test results.
+class CrewCandidate{
+ constructor(name = "", mass ="", scores = []){
+ this.name = name
+ this.mass = mass
+ this.scores = scores //[]
+ }
+ addScore(newScore){
+ this.scores.push(newScore)
+ }
+ average(){
+ let total = 0;
+ for(let i = 0; i < this.scores.length; i++){
+ total += this.scores[i]
+ }
+ let average = Math.round(total/this.scores.length *10)/10;
+ return average
+ }
-//Add methods for adding scores, averaging scores and determining candidate status as described in the studio activity.
+ status () {
+ let average = this.average(
+ )
+ if (average >=90){
+ return "Accepted"
+ }
+
+ else if (average >=80 )
+ {
+ return "Reserved"
+ }
+
+
+ else if (average>=70 )
+ {
+ return "Probationary"
+ }
+
+ else
+ {
+ return "Rejected!"
+ }
+
+ }
+}
+
+let bubbaBear = new CrewCandidate("Bubba Bear", 135,[88,85,90])
+let merryMaltese = new CrewCandidate("Merry Maltese",1.5,[93,88,97])
+let gladGator = new CrewCandidate("Glad Gator",225,[75,78,62])
+bubbaBear.addScore(83)
+console.log(bubbaBear.scores)
+console.log(merryMaltese.average())
-//Part 4 - Use the methods to boost Glad Gator’s status to Reserve or higher. How many tests will it take to reach Reserve status? How many to reach Accepted? Remember, scores cannot exceed 100%.
\ No newline at end of file
diff --git a/css/exercises/index.html b/css/exercises/index.html
index 69f47f9239..b8fae5b53c 100644
--- a/css/exercises/index.html
+++ b/css/exercises/index.html
@@ -9,13 +9,13 @@
- My Very Cool Web Page
- Why this Website is Very Cool
-
+ My Very Cool Web Page
+ Why this Website is Very Cool
+
- I made it!
- This website is colorful!
- Why I love Web Development
+ Why I love Web Development
Web Development is a very cool skill that I love learning!
I love making websites because all I have to do is reload the page to see the changes I have made!
diff --git a/css/exercises/styles.css b/css/exercises/styles.css
index 3b88bed453..e366201c1e 100644
--- a/css/exercises/styles.css
+++ b/css/exercises/styles.css
@@ -1 +1,16 @@
/* Start adding your styling below! */
+body {
+ background-color: yellow;
+}
+
+h1 {
+ font-size: 36px;
+}
+
+.center {
+ text-align: center;
+}
+
+#list-color {
+ color: blueviolet;
+}
\ No newline at end of file
diff --git a/data-and-variables/exercises/data-and-variables-exercises.js b/data-and-variables/exercises/data-and-variables-exercises.js
index 6433bcd641..3f1c8b1c12 100644
--- a/data-and-variables/exercises/data-and-variables-exercises.js
+++ b/data-and-variables/exercises/data-and-variables-exercises.js
@@ -1,11 +1,26 @@
// 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 = kilometersToMars * milesPerKilometer;
+let hoursToMars = milesToMars / shuttleSpeedMph;
+let daysToMars = hoursToMars / 24;
// Print the results of the space mission calculations below
-
+consolelog(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 = kilometersToMoon * milesPerKilometer;
+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/dom-and-events/exercises/script.js b/dom-and-events/exercises/script.js
index de6b630519..f94b6e5c42 100644
--- a/dom-and-events/exercises/script.js
+++ b/dom-and-events/exercises/script.js
@@ -4,7 +4,25 @@ function init () {
const paragraph = document.getElementById("statusReport");
// Put your code for the exercises here.
-
+ button.addEventListener('click', event => {
+ paragraph.innerHTML = 'Houston! We have liftoff!';
+});
+
+ button.addEventListener('mouseover', function (event) {
+
+ })
+
+ missionAbort.addEventListener("mouseover", function( event ) {
+ event.target.style.backgroundColor = "red";
+});
+
+ missionAbort.addEventListener("mouseout", function( event ) {
+ event.target.style.backgroundColor = "";
+});
+
+ button.addEventListener('click', event => {
+ paragraph.innerHTML = 'Houston! We have liftoff!';
+});
}
window.addEventListener("load", init);
diff --git a/dom-and-events/studio/scripts.js b/dom-and-events/studio/scripts.js
index 45c9b3a9d1..b41da1f0d6 100644
--- a/dom-and-events/studio/scripts.js
+++ b/dom-and-events/studio/scripts.js
@@ -1,2 +1,3 @@
// Write your JavaScript code here.
+
// Remember to pay attention to page loading!
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/DebuggingLogicErrors1.js b/errors-and-debugging/exercises/DebuggingLogicErrors1.js
index 1ad473f08d..b877b404e0 100644
--- a/errors-and-debugging/exercises/DebuggingLogicErrors1.js
+++ b/errors-and-debugging/exercises/DebuggingLogicErrors1.js
@@ -1,6 +1,6 @@
// Run this sample code as-is and examine the output.
-// Should the shuttle have launched?
-// Did it?
+// Should the shuttle have launched? NO!
+// Did it? YES
// Do not worry about fixing the code yet, we will do that in the next series of exercises.
let launchReady = false;
diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors2.js b/errors-and-debugging/exercises/DebuggingLogicErrors2.js
index 160a0c2cd0..b3be7fa137 100644
--- a/errors-and-debugging/exercises/DebuggingLogicErrors2.js
+++ b/errors-and-debugging/exercises/DebuggingLogicErrors2.js
@@ -17,6 +17,9 @@ if (fuelLevel >= 20000) {
launchReady = false;
}
+console.log(launchReady)
+
+
// if (crewStatus && computerStatus === 'green'){
// console.log('Crew & computer cleared.');
// launchReady = true;
diff --git a/errors-and-debugging/exercises/DebuggingLogicErrors5.js b/errors-and-debugging/exercises/DebuggingLogicErrors5.js
index 7eb908e769..d5e8bdfb8f 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';
@@ -14,15 +15,13 @@ if (fuelLevel >= 20000) {
console.log('WARNING: Insufficient fuel!');
launchReady = false;
}
-
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);
\ No newline at end of file
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/functions/exercises/exercises.js b/functions/exercises/exercises.js
new file mode 100644
index 0000000000..c588913fb4
--- /dev/null
+++ b/functions/exercises/exercises.js
@@ -0,0 +1,37 @@
+function makeLine(size) {
+ let line = '';
+ for (let i = 0; i < size; i++) {
+ line += '#';
+ }
+ return line;
+}
+
+console.log(makeLine(5));
+
+
+console.log(makeSquare(5));
+
+function makeRectangle(width, height) {
+ let rectangle = '';
+ for (let i = 0; i < height; i++) {
+ rectangle += (makeLine(width) + '\n');
+ }
+ return rectangle.slice(0, -1);
+}
+
+
+function makeDownwardStairs(height) {
+ let stairs = '';
+ for (let i = 0; i < height; i++) {
+ stairs += (makeLine(i+1) + '\n');
+ }
+ return stairs.slice(0, -1);
+}
+
+function makeIsoscelesTriangle(height) {
+ let triangle = '';
+ for (let i = 0; i < height; i++) {
+ triangle += (makeSpaceLine(height - i - 1, 2*i + 1) + '\n');
+ }
+ return triangle.slice(0, -1);
+}
\ No newline at end of file
diff --git a/functions/studio/studio-functions.js b/functions/studio/studio-functions.js
index d4c291ed1a..d7e217a08d 100644
--- a/functions/studio/studio-functions.js
+++ b/functions/studio/studio-functions.js
@@ -3,6 +3,17 @@
// Part One: Reverse Characters
// 1. Define the function as reverseCharacters. Give it one parameter, which will be the string to reverse.
+function reverseCharacters(input){
+if (typeof input ==="number"){
+let reversedString=input.toString().split('').reverse("").join("");
+} else
+return input.split('').reverse().join('');
+
+}
+
+let myVariableName = "Hello World!";
+
+console.log(reverseCharacters(myVariableName));
// 2. Within the function, split the string into an array, then reverse the array.
// 3. Use join to create the reversed string and return that string from the function.
// 4. Below the function, define and initialize a variable to hold a string.
@@ -18,7 +29,13 @@
// 5. Be sure to print the result returned by the function to verify that your code works for both strings and numbers. Do this before moving on to the next exercise.
// Part Three: Complete Reversal
-
+function completeReversal(arrayInput){
+ let emptyArray=[];
+ for (arrayInput[i]=0; i
-
-
-
-
+Why I Love Web Development
+WebElements