diff --git a/README.md b/README.md deleted file mode 100644 index 22d84a3..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# MD201-01 \ No newline at end of file diff --git a/lab-01/README.md b/lab-01/README.md index 50861f6..536c03f 100644 --- a/lab-01/README.md +++ b/lab-01/README.md @@ -1,3 +1,8 @@ +# Updated README.md +This is the pair programming challenge from June 30, 2018, in which I served as driver while Brittany was the navigator. We are going to be adding functions to Brittany's code, and move the logic for the individual questions into separate functions, and call those functions to run the game. + +According to the assignment: In its most basic sense, this is pretty simple and straightforward: 'wrap' the logic and variables for a given question with function someFuncNameYouChoose() { at the beginning, and add a closing curly brace } at the end. To make the function execute, just call it afterwards: someFuncNameYouChoose(); After completing this step the game should behave exactly as it did before. a-c-p + # Assignment Overview: Lab 1 - Write a program that accepts user input and, based on that input, displays messages back to the user. diff --git a/lab-01/index.html b/lab-01/index.html new file mode 100644 index 0000000..be4db77 --- /dev/null +++ b/lab-01/index.html @@ -0,0 +1,30 @@ + + + + + + + + + + About me + + + + +

All About Name

+ + + What are your top three favorite movies? +
    +
  1. firstMovie
  2. +
  3. secondMovie
  4. +
  5. thirdMovie
  6. +
+ + + \ No newline at end of file diff --git a/lab-01/main.css b/lab-01/main.css new file mode 100644 index 0000000..b2828f1 --- /dev/null +++ b/lab-01/main.css @@ -0,0 +1 @@ +/* Harold is awesome! He is the best collaborator ever! -hw */ \ No newline at end of file diff --git a/lab-01/main.js b/lab-01/main.js new file mode 100644 index 0000000..1b59d27 --- /dev/null +++ b/lab-01/main.js @@ -0,0 +1,135 @@ +// This code includes everything uploaded to gh-pages, not what was on the origin branch that was originally cloned -hw + +let captchaArray = ['A','B','C','D','E','F','G','H','J','K','L','M','N', 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z','2', '3', '4', '5', '6', '7', '8', '9'] + +let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)] + captchaArray[Math.floor(Math.random() * captchaArray.length)]+ captchaArray[Math.floor(Math.random() * captchaArray.length)]; + +// let captchaArray = ["erFY4", "br9kl", "qwbM7", "DejK8", "CDxz8", "wefk3", "qwkl8", "Pgh2m", "Wfz5m", "Tgh3M"]; +// let captcha = captchaArray[Math.floor(Math.random() * captchaArray.length)]; + +alert("Hi!"); + +// Check captcha, if incorrect ask user to try again +let captchaResponse = prompt("First, let's make sure you're human. Please type the following (case sensitive): " + captcha); +console.log("Initial ask: " + captchaResponse); +while (captchaResponse != captcha) { + captchaResponse = prompt("Incorrect response. Please try again. Please type the following (case sensitive): " + captcha); + console.log("New user captcha response: " + captchaResponse) +} + +let nameFunction = function() { + return prompt("What's your name?"); +} + +let colorFunction = function() { + return prompt("What's your favorite color?"); +} + +let animalFunction = function() { + return prompt("What's your favorite animal?"); +} + +let bandFunction = function() { + return prompt("What's your favorite band?"); +} + +let movie1Function = function () { + return prompt("First favorite movie"); +} + +let movie2Function = function () { + return prompt("Second favorite movie"); +} + +let movie3Function = function () { + return prompt("Third favorite movie"); +} + +//Brittany's updated code for NAME that is wrapped in a function +let name = nameFunction() +console.log(name) + +//Brittany's original code (does not include functions) +//let name = prompt("What's your name?"); +//console.log(name); + +//Brittany's updated code for COLOR that is wrapped in a function +let color = colorFunction() +console.log(color) + +//Brittany's original code (does not include functions) +//let faveColor = prompt("What's your favorite color?"); +//console.log(prompt); + +//Brittany's updated code for ANIMAL that is wrapped in a function +let animal = animalFunction() +console.log(animal) + +//Brittany's original code (does not include functions) +//let faveAnimal = prompt("What's your favorite animal?"); +//console.log(faveAnimal); + +//Brittany's updated code for BAND that is wrapped in a function +let band = bandFunction() +console.log(band) + +//Brittany's original code (does not include functions) +//let faveBand = prompt("What's your favorite band?"); +//console.log(faveBand); + + +confirm("Hi, "+ name + "! It's nice to meet you. My favorite color is " + color + " too. But I'm allergic to " + animal + "s. Did you hear that " + band + " is in town next week?"); + +alert("What are your top three favorite movies?") + + +// Brittany's updated code for three favorite movies wrapped in three functions +let firstMovie = movie1Function() +console.log(firstMovie) + +let secondMovie = movie2Function() +console.log(secondMovie) + +let thirdMovie = movie3Function() +console.log (thirdMovie) + +// Brittany's original code for her three favorite movie questions (does not include functions) +// let firstMovie = prompt("First favorite movie"); +// console.log(firstMovie); + +// let secondMovie = prompt("Second favorite movie"); +// console.log(secondMovie); + +// let thirdMovie = prompt("Third favorite movie"); +// console.log(thirdMovie); + + +confirm("Oh, I love " + firstMovie + "! But I haven't seen " + secondMovie + " or " + thirdMovie + " though."); + +if(name){ + document.getElementById('name').innerText = name +} + +if(faveColor){ + document.getElementById('faveColor').innerText = color +} + +if(faveAnimal){ + document.getElementById('faveAnimal').innerText = animal +} + +if(faveBand){ + document.getElementById('faveBand').innerText = band +} + +if(firstMovie){ + document.getElementById('firstMovie').innerText = firstMovie +} + +if(secondMovie){ + document.getElementById('secondMovie').innerText = secondMovie +} + +if(thirdMovie){ + document.getElementById('thirdMovie').innerText = thirdMovie +} \ No newline at end of file