diff --git a/Lesson02-HTML-CSS/homework/homework.html b/Lesson02-HTML-CSS/homework/homework.html
index b722c6acc..51633b2b0 100644
--- a/Lesson02-HTML-CSS/homework/homework.html
+++ b/Lesson02-HTML-CSS/homework/homework.html
@@ -1 +1,31 @@
-
\ No newline at end of file
+
+
+
+ David Winchester's HTML homework
+
+
+
+
+
+
+
David Winchester
+
Lambda School
+
HTML/CSS homework
+
+
+ St. Louis does pizza in a very unique way. The crust is very thin. It's also unleavened, which makes it cracker-like. It's cut it into squares. Most importantly, it uses a unique cheese called Provel. It's like mozzarella, but not stretchy and with flavor.
+ Imo's Pizza
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Lesson02-HTML-CSS/homework/styles.css b/Lesson02-HTML-CSS/homework/styles.css
new file mode 100644
index 000000000..07bcbf8e1
--- /dev/null
+++ b/Lesson02-HTML-CSS/homework/styles.css
@@ -0,0 +1,33 @@
+h1 {
+ color: darkslateblue;
+}
+
+img {
+ width: 400px;
+}
+
+#thirdDiv {
+ height: 600px;
+ width: 500px;
+ background-color: whitesmoke;
+ padding: 50px;
+}
+
+.spanId {
+ font-size: 18px;
+ margin: 50px;
+}
+
+.divClass {
+ text-align: center;
+}
+
+.container {
+ margin: auto;
+ width: 600px;
+}
+
+html {
+ background: url("https://upload.wikimedia.org/wikipedia/commons/4/48/STL_Skyline_2007_edit.jpg") no-repeat center fixed;
+ background-color: #cccccc;
+}
\ No newline at end of file
diff --git a/Lesson03-CSS-Positioning/homework/homework.css b/Lesson03-CSS-Positioning/homework/homework.css
index a45394a92..7d3a0b726 100644
--- a/Lesson03-CSS-Positioning/homework/homework.css
+++ b/Lesson03-CSS-Positioning/homework/homework.css
@@ -6,38 +6,55 @@ in this folder, you are in the wrong place.
/* Exercise One: Centering the text in a span */
+
/* We will start this one off for you: */
-#exerciseOne {
+#exerciseOne {
+ text-align: center;
+ display: block;
}
/* Exercise Two: Positioning a Header Bar*/
-/* Place code here */
-
+#exerciseTwo {
+ color: #e5efff;
+ border: 1px solid #e5efff;
+}
/* Exercise Three: */
-/* Place code here */
-
+#exerciseThree {
+ margin-left: 200px;
+ margin-top: 100px;
+}
/* Exercise Four: */
-/* Place code here */
-
+#exerciseFour {
+ position: fixed;
+ top: 0;
+ left: 0;
+}
/* Exercise Five */
-/* Place code here */
-
+#exerciseFive {
+ display: flex;
+ flex-direction: row-reverse;
+ justify-content: space-evenly;
+ align-items: center;
+}
/* Exercise Six */
#exerciseSeven {
- display: flex;
-}
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: stretch;
+}
\ No newline at end of file
diff --git a/Lesson04-JS-I/homework/homework.js b/Lesson04-JS-I/homework/homework.js
index 0d3fc31dd..8346aaeec 100755
--- a/Lesson04-JS-I/homework/homework.js
+++ b/Lesson04-JS-I/homework/homework.js
@@ -1,22 +1,22 @@
//In these first 6 questions, replace `null` with the answer
//create a string variable, it can contain anything
-const newString = null ;
+const newString = 'Yadier';
//create a number variable, it an be any number
-const newNum = null ;
+const newNum = 42;
//create a boolean variable
-const newBool = null ;
+const newBool = true;
//solve the following math problem
-const newSubtract = 10 - null === 5;
+const newSubtract = 10 - 5 === 5;
//Solve the following math problem
-const newMultiply = 10 * null === 40 ;
+const newMultiply = 10 * 4 === 40;
//Solve the following math problem:
-const newModulo = 21 % 5 === null ;
+const newModulo = 21 % 5 === 1;
@@ -26,158 +26,160 @@ const newModulo = 21 % 5 === null ;
//Do not change any of the function names
function returnString(str) {
- //simply return the string provided: str
+ const printout = str;
+ return printout;
}
function add(x, y) {
- // x and y are numbers
- // add x and y together and return the value
- // code here
+ const sum = x + y;
+ return sum;
}
function subtract(x, y) {
- // subtract y from x and return the value
- // code here
+ const difference = x - y;
+ return difference;
}
function multiply(x, y) {
- // multiply x by y and return the value
- // code here
+ const product = x * y;
+ return product;
}
function divide(x, y) {
- // divide x by y and return the value
- // code here
+ const quotient = x / y;
+ return quotient;
}
function areEqual(x, y) {
- // return true if x and y are the same
- // otherwise return false
- // code here
+ if (x === y) {
+ return true;
+ }
+ return false;
}
function areSameLength(str1, str2) {
- // return true if the two strings have the same length
- // otherwise return false
- // code here
+ if (str1.length === str2.length) {
+ return true;
+ }
+ return false;
}
function lessThanNinety(num) {
- // return true if the function argument: num , is less than ninety
- // otherwise return false
- // code here
+ if (num < 90) {
+ return true;
+ }
+ return false;
}
function greaterThanFifty(num) {
- // return true if num is greater than fifty
- // otherwise return false
- // code here
+ if (num > 50) {
+ return true;
+ }
+ return false;
}
function getRemainder(x, y) {
- // return the remainder from dividing x by y
- // code here
+ const modulus = x % y;
+ return modulus;
}
function isEven(num) {
- // return true if num is even
- // otherwise return false
- // code here
+ if (num % 2 === 0) {
+ return true;
+ }
+ return false;
}
function isOdd(num) {
- // return true if num is odd
- // otherwise return false
- // code here
+ if (num % 2 === 1) {
+ return true;
+ }
+ return false;
}
function square(num) {
- // square num and return the new value
- // hint: NOT square root!
- // code here
+ const secondPwr = Math.pow(num, 2);
+ return secondPwr;
}
function cube(num) {
- // cube num and return the new value
- // code here
+ const thirdPwr = Math.pow(num, 3);
+ return thirdPwr;
}
function raiseToPower(num, exponent) {
- // raise num to whatever power is passed in as exponent
- // code here
+ const risen = Math.pow(num, exponent);
+ return risen;
}
function roundNumber(num) {
- // round num and return it
- // code here
+ const rnd = Math.round(num);
+ return rnd;
}
function roundUp(num) {
- // round num up and return it
- // code here
+ const rndUp = Math.ceil(num);
+ return rndUp;
}
function addExclamationPoint(str) {
- // add an exclamation point to the end of str and return the new string
- // 'hello world' -> 'hello world!'
- // code here
+ const addExcPnt = str + '!';
+ return addExcPnt;
}
function combineNames(firstName, lastName) {
- // return firstName and lastName combined as one string and separated by a space.
- // 'Lambda', 'School' -> 'Lambda School'
- // code here
+ const bothNames = firstName + ' ' + lastName;
+ return bothNames;
}
function getGreeting(name) {
- // Take the name string and concatenate other strings onto it so it takes the following form:
- // 'Sam' -> 'Hello Sam!'
- // code here
+ const hello = 'Hello ' + name + '!';
+ return hello;
}
// The next three questions will have you implement math area formulas.
// If you can't remember these area formulas then head over to Google.
-
+
function getRectangleArea(length, width) {
- // return the area of the rectangle by using length and width
- // code here
+ const area = length * width;
+ return area;
}
function getTriangleArea(base, height) {
- // return the area of the triangle by using base and height
- // code here
+ const areaTri = (base * height) / 2;
+ return areaTri;
}
// Do not modify code below this line.
// --------------------------------
module.exports = {
- newString,
- newNum,
- newBool,
- newSubtract,
- newMultiply,
- newModulo,
- returnString,
- areSameLength,
- areEqual,
- lessThanNinety,
- greaterThanFifty,
- add,
- subtract,
- divide,
- multiply,
- getRemainder,
- isEven,
- isOdd,
- square,
- cube,
- raiseToPower,
- roundNumber,
- roundUp,
- addExclamationPoint,
- combineNames,
- getGreeting,
- getRectangleArea,
- getTriangleArea,
-};
+ newString,
+ newNum,
+ newBool,
+ newSubtract,
+ newMultiply,
+ newModulo,
+ returnString,
+ areSameLength,
+ areEqual,
+ lessThanNinety,
+ greaterThanFifty,
+ add,
+ subtract,
+ divide,
+ multiply,
+ getRemainder,
+ isEven,
+ isOdd,
+ square,
+ cube,
+ raiseToPower,
+ roundNumber,
+ roundUp,
+ addExclamationPoint,
+ combineNames,
+ getGreeting,
+ getRectangleArea,
+ getTriangleArea,
+};
\ No newline at end of file
diff --git a/Lesson05-JS-II/homework/homework.js b/Lesson05-JS-II/homework/homework.js
index 6f97f8d61..81d51da24 100755
--- a/Lesson05-JS-II/homework/homework.js
+++ b/Lesson05-JS-II/homework/homework.js
@@ -1,50 +1,74 @@
// Do not change any of the function names
function getBiggest(x, y) {
- // x and y are integers. Return the larger integer
- // if they are the same return either one
+ if (x > y) {
+ return x;
+ } else {
+ return y;
+ }
}
function greeting(language) {
- // return a greeting for three different languages:
- // language: 'German' -> 'Guten Tag!'
- // language: 'Mandarin' -> 'Ni Hao!'
- // language: 'Spanish' -> 'Hola!'
- // if language is undefined return 'Hello!'
+ let greet = '';
+ if (language === 'German') {
+ greet = 'Guten Tag!';
+ } else if (language === 'Mandarin') {
+ greet = 'Ni Hao!';
+ } else if (language === 'Spanish') {
+ greet = 'Hola!';
+ } else {
+ greet = 'Hello!';
+ }
+ return greet;
}
function isTenOrFive(num) {
- // return true if num is 10 or 5
- // otherwise return false
+ if (num === 10 || num === 5) {
+ return true;
+ }
+ return false;
}
function isInRange(num) {
- // return true if num is less than 50 and greater than 20
- // otherwise return false
+ if (num < 50 && num > 20) {
+ return true;
+ }
+ return false;
}
function isInteger(num) {
- // return true if num is an integer
- // 0.8 -> false
- // 1 -> true
- // -10 -> true
- // otherwise return false
- // hint: you can solve this using Math.floor
+ if (Math.floor(num) === num) {
+ return true;
+ }
+ return false;
}
function fizzBuzz(num) {
- // if num is divisible by 3 return 'fizz'
- // if num is divisible by 5 return 'buzz'
- // if num is divisible by 3 & 5 return 'fizzbuzz'
- // otherwise return num
+ let phrase = '';
+ if (num % 3 === 0) {
+ phrase = phrase + 'fizz';
+ }
+ if (num % 5 === 0) {
+ phrase = phrase + 'buzz';
+ }
+ if (phrase !== '') {
+ return phrase;
+ }
+ return num;
}
function isPrime(num) {
- // return true if num is prime.
- // otherwise return false
- // hint: a prime number is only evenly divisible by itself and 1
- // hint2: you can solve this using a for loop
- // note: 0 and 1 are NOT considered prime numbers
+ for (let i = 2; i < num / 2; i++) {
+ if (num % i === 0) {
+ return false;
+ }
+ }
+ if (num <= 0) {
+ return false;
+ } else if (num === 1) {
+ return false;
+ }
+ return true;
}
@@ -53,11 +77,11 @@ function isPrime(num) {
// --------------------------------
module.exports = {
- getBiggest,
- greeting,
- isTenOrFive,
- isInRange,
- isInteger,
- fizzBuzz,
- isPrime,
-};
+ getBiggest,
+ greeting,
+ isTenOrFive,
+ isInRange,
+ isInteger,
+ fizzBuzz,
+ isPrime,
+};
\ No newline at end of file
diff --git a/Lesson06-JS-III/homework/homework.js b/Lesson06-JS-III/homework/homework.js
index dd99592c7..87d70a4da 100644
--- a/Lesson06-JS-III/homework/homework.js
+++ b/Lesson06-JS-III/homework/homework.js
@@ -1,81 +1,112 @@
// Do not change any of the function names
function returnFirst(arr) {
- // return the first item from the array
+ return arr[0];
}
function returnLast(arr) {
- // return the last item of the array
+ return arr[arr.length - 1];
}
function getArrayLength(arr) {
- // return the length of the array
+ return arr.length;
}
function incrementByOne(arr) {
- // arr is an array of integers
- // increase each integer by one
- // return the array
+ for (let i = 0; i < arr.length; i++) {
+ arr[i] = arr[i] + 1;
+ }
+ return arr;
}
function addItemToArray(arr, item) {
- // add the item to the end of the array
- // return the array
+ arr.push(item);
+ return arr;
}
function addItemToFront(arr, item) {
- // add the item to the front of the array
- // return the array
- // hint: use the array method .unshift
+ arr.unshift(item);
+ return arr;
}
+
function wordsToSentence(words) {
- // words is an array of strings
- // return a string that is all of the words concatenated together
- // spaces need to be between each word
- // example: ['Hello', 'world!'] -> 'Hello world!'
+ let output = '';
+ for (let i = 0; i < words.length; i++) {
+ output = output + words[i];
+ if (i < (words.length - 1)) {
+ output = output + ' ';
+ }
+ }
+ return output;
}
+
function contains(arr, item) {
- // check to see if item is inside of arr
- // return true if it is, otherwise return false
+ for (let i = 0; i < arr.length; i++) {
+ if (arr[i] === item) {
+ return true;
+ }
+ }
+ return false;
}
function addNumbers(numbers) {
- // numbers is an array of integers.
- // add all of the integers and return the value
+ let sum = numbers[0];
+ for (let i = 1; i < numbers.length; i++) {
+ sum = sum + numbers[i];
+ }
+ return sum;
}
+
+
function averageTestScore(testScores) {
- // testScores is an array. Iterate over testScores and compute the average.
- // return the average
+ let sum = testScores[0];
+ for (let i = 1; i < testScores.length; i++) {
+ sum = sum + testScores[i];
+ }
+ let avg = sum / testScores.length;
+ return avg;
}
+
function largestNumber(numbers) {
- // numbers is an array of integers
- // return the largest integer
+ let big = numbers[0];
+ for (let i = 1; i < numbers.length; i++) {
+ if (big < numbers[i]) {
+ big = numbers[i];
+ }
+ }
+ return big;
}
+
function multiplyArguments() {
- // use the arguments keyword to multiply all of the arguments together and return the product
- // if no arguments are passed in return 0
- // if one argument is passed in just return it
+ let product = 1;
+ for (let i = 0; i < arguments.length; i++) {
+ product = product * arguments[i];
+ }
+ if (arguments.length === 0) {
+ return 0;
+ }
+ return product;
}
// Do not modify code below this line.
// --------------------------------
module.exports = {
- returnFirst,
- returnLast,
- getArrayLength,
- incrementByOne,
- addItemToArray,
- addItemToFront,
- wordsToSentence,
- contains,
- addNumbers,
- averageTestScore,
- largestNumber,
- multiplyArguments,
-};
+ returnFirst,
+ returnLast,
+ getArrayLength,
+ incrementByOne,
+ addItemToArray,
+ addItemToFront,
+ wordsToSentence,
+ contains,
+ addNumbers,
+ averageTestScore,
+ largestNumber,
+ multiplyArguments,
+};
\ No newline at end of file
diff --git a/Lesson07-JS-IV/homework/homework.js b/Lesson07-JS-IV/homework/homework.js
index 5fe8a0116..24ee6ff87 100755
--- a/Lesson07-JS-IV/homework/homework.js
+++ b/Lesson07-JS-IV/homework/homework.js
@@ -1,109 +1,118 @@
// Do not change any of the function names
function makeCat(name, age) {
- // create a new object with a name property with the value set to the name argument
- // add an age property to the object with the value set to the age argument
- // add a method called meow that returns the string 'Meow!'
- // return the object
+ const cat = {
+ name: name,
+ age: age,
+ meow: function() {
+ return 'Meow!';
+ },
+ };
+ return cat;
}
function addProperty(object, property) {
- // add the property to the object with a value of null
- // return the object
- // note: the property name is NOT 'property'. The name is the value of the argument called property (a string)
+ const value = property;
+ object[value] = null;
+ return object;
}
function invokeMethod(object, method) {
- // method is a string that contains the name of a method on the object
- // invoke this method
- // nothing needs to be returned
+ const func = method;
+ object[func]();
}
function multiplyMysteryNumberByFive(mysteryNumberObject) {
- // mysteryNumberObject has a property called mysteryNumber
- // multiply the mysteryNumber property by 5 and return the product
+ let product = mysteryNumberObject.mysteryNumber * 5;
+ return product;
}
function deleteProperty(object, property) {
- // remove the property from the object
- // return the object
+ const value = property;
+ delete object[value];
+ return object;
}
function newUser(name, email, password) {
- // create a new object with properties matching the arguments passed in.
- // return the new object
+ const user = {
+ name: name,
+ email: email,
+ password: password,
+ };
+ return user;
}
function hasEmail(user) {
- // return true if the user has a value for the property 'email'
- // otherwise return false
+ if (!user.email || user.email === '') {
+ return false;
+ }
+ return true;
}
function hasProperty(object, property) {
- // return true if the object has the value of the property argument
- // property is a string
- // otherwise return false
+ const val = property;
+ if (object[val]) {
+ return true;
+ }
+ return false;
}
function verifyPassword(user, password) {
- // check to see if the provided password matches the password property on the user object
- // return true if they match
- // otherwise return false
+ if (user.password === password) {
+ return true;
+ }
+ return false;
}
function updatePassword(user, newPassword) {
- // replace the existing password on the user object with the value of newPassword
- // return the object
+ user['password'] = newPassword;
+ return user;
}
function addFriend(user, newFriend) {
- // user has a property called friends that is an array
- // add newFriend to the end of the friends array
- // return the user object
+ user['friends'].push(newFriend);
+ return user;
}
function setUsersToPremium(users) {
- // users is an array of user objects.
- // each user object has the property 'isPremium'
- // set each user's isPremium property to true
- // return the users array
+ for (let i = 0; i < users.length; i++) {
+ users[i].isPremium = true;
+ }
+ return users;
}
function sumUserPostLikes(user) {
- // user has an array property called 'posts'
- // posts is an array of post objects
- // each post object has an integer property called 'likes'
- // sum together the likes from all the post objects
- // return the sum
+ let sum = 0;
+ for (let i = 0; i < user.posts.length; i++) {
+ sum = sum + user.posts[i].likes;
+ }
+ return sum;
}
function addCalculateDiscountPriceMethod(storeItem) {
- // add a method to the storeItem object called 'calculateDiscountPrice'
- // this method should multiply the storeItem's 'price' and 'discountPercentage' to get the discount
- // the method then subtracts the discount from the price and returns the discounted price
- // return storeItem at the end of the function
- // example:
- // price -> 20
- // discountPercentage -> .2
- // discountPrice = 20 - (20 * .2)
+ storeItem.calculateDiscountPrice = function() {
+ let discountPrice = storeItem['price'] - (storeItem['price'] * storeItem['discountPercentage']);
+ return discountPrice;
+ };
+ return storeItem;
}
// Do not modify code below this line.
// --------------------------------
module.exports = {
- makeCat,
- addProperty,
- invokeMethod,
- multiplyMysteryNumberByFive,
- deleteProperty,
- newUser,
- hasEmail,
- hasProperty,
- verifyPassword,
- updatePassword,
- addFriend,
- setUsersToPremium,
- sumUserPostLikes,
- addCalculateDiscountPriceMethod,
-};
+ makeCat,
+ addProperty,
+ invokeMethod,
+ multiplyMysteryNumberByFive,
+ deleteProperty,
+ newUser,
+ hasEmail,
+ hasProperty,
+ verifyPassword,
+ updatePassword,
+ addFriend,
+ setUsersToPremium,
+ sumUserPostLikes,
+ addCalculateDiscountPriceMethod,
+};
\ No newline at end of file
diff --git a/newFile.js b/newFile.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/package.json b/package.json
index a057164c4..4c5eec29f 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,6 @@
"homepage": "https://github.com/lambdaschool/precourse#readme",
"devDependencies": {
"eslint": "^4.13.1",
- "jest": "^22.0.3"
+ "jest": "^24.7.1"
}
}