From 9dc8a2a883fd06b1722e677143ad1ed56763c056 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 10:43:03 -0700 Subject: [PATCH 01/28] updated ReadMe --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 33ff22636..ccabffaf0 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,14 @@ Exercises are outlined in the `index.js` file, please read the instructions care ## Instructions -### Task 1: Set up Project +### [x] Task 1: Set up Project Using VSCode and Command Line: -1. Fork repo and add TL as collaborator on Github. -2. Clone your fork (not Lambda's repo by mistake!). -3. `cd` into your newly cloned repository. -4. Create a new branch by typing `git checkout -b `. +[x] 1. Fork repo and add TL as collaborator on Github. +[x] 2. Clone your fork (not Lambda's repo by mistake!). +[x] 3. `cd` into your newly cloned repository. +[x] 4. Create a new branch by typing `git checkout -b `. ### Task 2: Complete MVP Requirements From d4213c9b8ffc7d0a2aa4920d22c3a9055ced471b Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 13:29:04 -0700 Subject: [PATCH 02/28] votingAge done --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 73f240372..d821349a7 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,12 @@ /************************************************************** Task 1: Warm-up! **************************************************************/ //Task a: declare a variable called votingAge, console log true if age > 18 (no function required) - - +var votingAge = 21; + if(votingAge > 18) { + console.log('true'); + } + if(votingAge < 18) { + console.log('false'); + } From 03e3d8d3a10dd701d50f06f52ab25b40eb7b82e9 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 13:37:41 -0700 Subject: [PATCH 03/28] Completed task b --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d821349a7..11e912763 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,14 @@ var votingAge = 21; //Task b: declare a variable and then use a conditional to change the value of that variable based on the value assigned to a second variable (no function required) - +var kitty = Math.round(Math.random(0, 1)); +if(kitty === 1){ + console.log('maine coon') +} +// if(kitty = 0){ +else{ + console.log('russian blue') +} From 6e0314ea13ba27ca330c6649ec705ed378ef1333 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 13:43:54 -0700 Subject: [PATCH 04/28] Completed task c --- index.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 11e912763..dad1e1a50 100644 --- a/index.js +++ b/index.js @@ -12,20 +12,19 @@ var votingAge = 21; //Task b: declare a variable and then use a conditional to change the value of that variable based on the value assigned to a second variable (no function required) var kitty = Math.round(Math.random(0, 1)); -if(kitty === 1){ - console.log('maine coon') -} -// if(kitty = 0){ -else{ - console.log('russian blue') -} + if(kitty === 1){ + console.log('maine coon') + } + // if(kitty = 0){ + else{ + console.log('russian blue') + } //Task c: Convert string ("1999") to integer (1999) (no function required) // hint look up the Number method - - +console.log(Number('123')); From 737ec3c87ab92cad0db285a64e1653232d35f8b7 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 13:55:28 -0700 Subject: [PATCH 05/28] completed task d --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index dad1e1a50..76cf72f9b 100644 --- a/index.js +++ b/index.js @@ -29,8 +29,12 @@ console.log(Number('123')); //Task d: Write a function to multiply a*b - - +let a = 4; +let b = 3; +// function meow(meowMix) { +// return a * b; +// } +console.log(a*b); From 7ddc499b5cdd8af3264c8ee31836a41d88b674ab Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 13:58:35 -0700 Subject: [PATCH 06/28] completed task 2 --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 76cf72f9b..85ee13bb5 100644 --- a/index.js +++ b/index.js @@ -41,7 +41,9 @@ console.log(a*b); /************************************************************** Task 2 **************************************************************/ //Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years - +let age = 28; +let dogYears = 7; +console.log("Wow, I'm " + age*dogYears + " years old in dog years."); From 77379bba2d1f6ba4028a10053dd55816c46cad17 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 14:37:17 -0700 Subject: [PATCH 07/28] completed task 3 --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 85ee13bb5..43ca6bed0 100644 --- a/index.js +++ b/index.js @@ -65,9 +65,22 @@ console.log("Wow, I'm " + age*dogYears + " years old in dog years."); // 7 - 12 months 4% of their body weight // when you are finished invoke your function with the weight of 15 lbs and the age of 1 year - if your calculations are correct your result should be 0.44999999999999996 - +let dogWeight = 15; +// let dogAge = 1; + +// function dogFeed(resultMatch) { +// if(resultMatch = dogWeight * 0.03) { +// console.log("Your dog needs " + resultMatch + "lbs. of food.") +// } +// dogFeed(dogWeight); +function dogFeeder(resultMaybe){ + if(resultMaybe === 'X'){ + console.log("Your dog needs " + (dogWeight * 0.03) + " lbs of food.") + } +} +dogFeeder('X') /************************************************************** Task 4 **************************************************************/ From c70683c1d43317e7b758eb8cc9d84ef0cc9fb0df Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 15:40:43 -0700 Subject: [PATCH 08/28] Had fun with Task 4 --- index.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 43ca6bed0..81a9933d8 100644 --- a/index.js +++ b/index.js @@ -82,7 +82,6 @@ function dogFeeder(resultMaybe){ } dogFeeder('X') - /************************************************************** Task 4 **************************************************************/ // Rock, Paper, Sissors // Your function should take a string (either rock paper or sissors) @@ -90,8 +89,33 @@ dogFeeder('X') // use math.random to determine the computers choice // hint while you can complete this with only conditionals based on strings it may help to equate choice to a number - - +const rock = 0; +const paper = 1; +const scissors = 2; + +// let 0 = rock; +// let 1 = paper; +// let 2 = scissors; + +let playerinput = 1;// 1 +let compyInput = Math.floor(Math.random() * 3); +if(compyInput === 0){ + console.log("Computer played rock. You played paper. You win!"); +} +if(compyInput === 1){ + console.log("Computer played paper. You played paper. It's a tie!"); +} +if(compyInput === 2){ + console.log("Computer played scissors. You played paper. The computer wins!"); +} + + +// function winnerResult(WinOrLose){ +// if(WinOrLose === 'Win'){} +// } +// winnerResult('Win'); + +// console.log("You chose " + playerinput " as your choice. The computer chose " + compyInput + ". You've " + winnerResult); /************************************************************** Task 5 **************************************************************/ //Metric Converter From 07a32f96f0233a9be8062ea0bbbbb8ebf3077684 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 15:43:36 -0700 Subject: [PATCH 09/28] task 5 a - done --- index.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 81a9933d8..b5498ebd3 100644 --- a/index.js +++ b/index.js @@ -109,19 +109,29 @@ if(compyInput === 2){ console.log("Computer played scissors. You played paper. The computer wins!"); } - -// function winnerResult(WinOrLose){ -// if(WinOrLose === 'Win'){} +// const compyArray = [ +// "rock", +// "scissors", +// "paper" +// ]; +// var compySelection = compyArray[Math.floor(Math.random()*compyArray.length)]; +// if(compySelection > playerinput){ +// console.log("The computer wins rock paper scissors! They played " + compySelection + " against your paper."); +// } +// if(compySelection === playerinput){ +// console.log("It's a tie! The computer played " + compySelection + " against your paper."); +// } +// if(compySelection < playerinput){ +// console.log("You won at rock paper scissors! The computer played " + compySelection + " against your paper."); // } -// winnerResult('Win'); - -// console.log("You chose " + playerinput " as your choice. The computer chose " + compyInput + ". You've " + winnerResult); /************************************************************** Task 5 **************************************************************/ //Metric Converter //a. KM to Miles - should take the number of kilometers and convert it to the equal number of miles - - +let kilometer = 5; +let miles = 0.621371; +console.log(kilometer * miles) +// answer: 3.10686 miles From ad8c11583b88ffa75b43c640f86dc90c7557c9b7 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 15:46:36 -0700 Subject: [PATCH 10/28] Finished task 5b --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b5498ebd3..147d3ce28 100644 --- a/index.js +++ b/index.js @@ -130,13 +130,16 @@ if(compyInput === 2){ //a. KM to Miles - should take the number of kilometers and convert it to the equal number of miles let kilometer = 5; let miles = 0.621371; -console.log(kilometer * miles) +console.log("5 km. converts to " + (kilometer * miles) + "mi.") // answer: 3.10686 miles //b. Feet to CM - should take the number of feet and convert it to the equal number of centimeters - +let feet = 5; +let centimeters = 30.48; +console.log("5 ft. converts to " + (feet * centimeters) + "cm.") +// answer: 152.4 cm. From e2437cf96c8bdadb033551ceac555190f9f9c0ae Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 15:54:54 -0700 Subject: [PATCH 11/28] Finished the soda on the wall --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 147d3ce28..925b6fbbe 100644 --- a/index.js +++ b/index.js @@ -148,7 +148,11 @@ console.log("5 ft. converts to " + (feet * centimeters) + "cm.") // 99 bottles of soda on the wall // create a function called annoyingSong // the function should take a starting number as an argument and count down - at each iteration it should log (number) bottles of soda on the wall, (number) bottles of soda, take one down pass it around (number left over) bottles of soda on the wall` - +// function annoyingSong() + +for(let i = 99; i > 0; i--){ + console.log("There are " + i + " bottles of soda on the wall. " + i + " bottles of soda. Take one down, pass it around, " + (i-1) + " bottles of soda on the wall."); +} From d97e4cf6dda73d7a99a03f18f5bbe7323f440a4e Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 16:02:21 -0700 Subject: [PATCH 12/28] finished task 7 --- index.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 925b6fbbe..30cb800e8 100644 --- a/index.js +++ b/index.js @@ -165,10 +165,22 @@ for(let i = 99; i > 0; i--){ //70s should be Cs //60s should be D //and anything below 60 should be F - - - - +let javaGrade = Math.floor(Math.random() * 101); +if(javaGrade >= 90 && javaGrade <= 101){ + console.log("You got " + javaGrade + " out of 100. You have an A."); +} +if(javaGrade >= 80 && javaGrade <= 90){ + console.log("You got " + javaGrade + " out of 100. You have a B."); +} +if(javaGrade >= 70 && javaGrade <= 80){ + console.log("You got " + javaGrade + " out of 100. You have a C."); +} +if(javaGrade >= 60 && javaGrade <= 70){ + console.log("You got " + javaGrade + " out of 100. You have a D."); +} +if(javaGrade >= 0 && javaGrade <= 60){ + console.log("You got " + javaGrade + " out of 100. You have a F."); +} /************************************************************** Stretch **************************************************************/ //Create a function that counts the number of vowels within a string. It should handle both capitalized and uncapitalized vowels. From 41c081b6145cc51e089eeb681540783758ae1c13 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 16:44:55 -0700 Subject: [PATCH 13/28] Attempting stretches - no cigar, yet! --- index.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 30cb800e8..7884063e4 100644 --- a/index.js +++ b/index.js @@ -187,15 +187,27 @@ if(javaGrade >= 0 && javaGrade <= 60){ // Hint - you may need to study tomorrow's traning kit on arrays // try looking up the .includes() method - - +// const stretch = "Create a function that counts the number of vowels within a string. It should handle both capitalized and uncapitalized vowels"; +// var stretchA = stretch.includes("a", "e", "i", "o", "u","A", "E", "I", "O", "U"); +// console.log(stretchA.length); /************************************************************** Stretch **************************************************************/ //Take Rock, Paper, Sissors further //update your rock papers sissors code below to take a prompt from a user using the window object +var stretch = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); +console.log(stretch) - - +let playerinput = stretch;// 1 +let compyInput = Math.floor(Math.random() * 3); +if(compyInput === 0){ + console.log("Computer played rock. You played paper. You win!"); +} +if(compyInput === 1){ + console.log("Computer played paper. You played paper. It's a tie!"); +} +if(compyInput === 2){ + console.log("Computer played scissors. You played paper. The computer wins!"); +} \ No newline at end of file From 17de487d8fd64fbee0f81619b868472147430a46 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 16:57:48 -0700 Subject: [PATCH 14/28] I think this fulfills the stretch goal --- index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 7884063e4..c05694c8c 100644 --- a/index.js +++ b/index.js @@ -197,17 +197,17 @@ if(javaGrade >= 0 && javaGrade <= 60){ //update your rock papers sissors code below to take a prompt from a user using the window object var stretch = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); -console.log(stretch) +console.log("Remainder: 0 being rock, 1 being paper, and 2 being scissors.You have entered " + stretch + " Your results are below.") +let compyInputB = Math.floor(Math.random() * 3); +console.log(compyInputB + " = where 0:rock, 1:paper, 2:scissors") -let playerinput = stretch;// 1 -let compyInput = Math.floor(Math.random() * 3); -if(compyInput === 0){ - console.log("Computer played rock. You played paper. You win!"); +if(compyInputB <= stretch){ + console.log("Stretch - You win!"); } -if(compyInput === 1){ - console.log("Computer played paper. You played paper. It's a tie!"); +if(compyInputB === stretch){ + console.log("Stretch - It's a tie!"); } -if(compyInput === 2){ - console.log("Computer played scissors. You played paper. The computer wins!"); +if(compyInputB >= stretch){ + console.log("Stretch - The computer wins!"); } \ No newline at end of file From 5abcce4eabfcecb83a83e0a8ed215759b1be4d03 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:05:04 -0700 Subject: [PATCH 15/28] Noticed a flaw with the math so... strings. --- index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.js b/index.js index c05694c8c..09f3efb79 100644 --- a/index.js +++ b/index.js @@ -198,6 +198,15 @@ if(javaGrade >= 0 && javaGrade <= 60){ var stretch = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); console.log("Remainder: 0 being rock, 1 being paper, and 2 being scissors.You have entered " + stretch + " Your results are below.") +if(stretch = 0) { + stretch = "rock"; +} +if(stretch = 1) { + stretch = "paper"; +} +if(stretch = 2) { + stretch = "scissors"; +} let compyInputB = Math.floor(Math.random() * 3); console.log(compyInputB + " = where 0:rock, 1:paper, 2:scissors") From d09e17fb49e2714524d68f88e9ec76a4ecb2c017 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:07:59 -0700 Subject: [PATCH 16/28] Figured out how to get a string as the output despite a numeric input --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 09f3efb79..57c9c301a 100644 --- a/index.js +++ b/index.js @@ -197,7 +197,6 @@ if(javaGrade >= 0 && javaGrade <= 60){ //update your rock papers sissors code below to take a prompt from a user using the window object var stretch = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); -console.log("Remainder: 0 being rock, 1 being paper, and 2 being scissors.You have entered " + stretch + " Your results are below.") if(stretch = 0) { stretch = "rock"; } @@ -207,9 +206,11 @@ if(stretch = 1) { if(stretch = 2) { stretch = "scissors"; } +console.log("You have entered " + stretch + ".") + let compyInputB = Math.floor(Math.random() * 3); -console.log(compyInputB + " = where 0:rock, 1:paper, 2:scissors") +console.log(compyInputB + " = Computer input, where 0:rock, 1:paper, 2:scissors") if(compyInputB <= stretch){ console.log("Stretch - You win!"); From 924c1405cdee212a0e84abea36f2366d6ec45b22 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:20:08 -0700 Subject: [PATCH 17/28] Whomp, used && incorrectly --- index.js | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 57c9c301a..72a60b16e 100644 --- a/index.js +++ b/index.js @@ -208,16 +208,41 @@ if(stretch = 2) { } console.log("You have entered " + stretch + ".") - let compyInputB = Math.floor(Math.random() * 3); -console.log(compyInputB + " = Computer input, where 0:rock, 1:paper, 2:scissors") - -if(compyInputB <= stretch){ - console.log("Stretch - You win!"); +if(compyInputB = 0) { + compyInputB = "rock"; + if(stretch = "scissors") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") + } + if(stretch = "paper") { + console.log("The computer has chosen " + compyInputB + ". You've won!") + } +} +if(compyInputB = 1) { + compyInputB = "paper"; + if(stretch = "rock") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") + } + if(stretch = "scissors") { + console.log("The computer has chosen " + compyInputB + ". You've won!") + } +} +if(compyInputB = 2) { + compyInputB = "scissors"; + if(stretch = "rock") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") + } + if(stretch = "paper") { + console.log("The computer has chosen " + compyInputB + ". You've won!") + } } + +// if(compyInputB = "rock" && stretch = "rock"){ +// console.log("Stretch - You win!"); +// } if(compyInputB === stretch){ console.log("Stretch - It's a tie!"); } -if(compyInputB >= stretch){ - console.log("Stretch - The computer wins!"); -} \ No newline at end of file +// if(compyInputB >= stretch){ +// console.log("Stretch - The computer wins!"); +// } \ No newline at end of file From f0fb51a219b0d3db06dfb6251607519ffe14d3da Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:24:14 -0700 Subject: [PATCH 18/28] Used && differently- still wrong! Whomp! --- index.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 72a60b16e..46b6e25af 100644 --- a/index.js +++ b/index.js @@ -211,30 +211,33 @@ console.log("You have entered " + stretch + ".") let compyInputB = Math.floor(Math.random() * 3); if(compyInputB = 0) { compyInputB = "rock"; - if(stretch = "scissors") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") - } - if(stretch = "paper") { - console.log("The computer has chosen " + compyInputB + ". You've won!") - } } if(compyInputB = 1) { compyInputB = "paper"; - if(stretch = "rock") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") - } - if(stretch = "scissors") { - console.log("The computer has chosen " + compyInputB + ". You've won!") - } } if(compyInputB = 2) { compyInputB = "scissors"; - if(stretch = "rock") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") - } - if(stretch = "paper") { - console.log("The computer has chosen " + compyInputB + ". You've won!") - } +} + +if(stretch = "rock") && if(compyInputB = "paper") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") +} +if(stretch = "rock") && if(compyInputB = "scissors") { + console.log("The computer has chosen " + compyInputB + ". You've won!") +} + +if(stretch = "paper") && if(compyInputB = "rock") { + console.log("The computer has chosen " + compyInputB + ". You've won!") +} +if(stretch = "paper") && if(compyInputB = "scissors") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") +} + +if(stretch = "scissors") && if(compyInputB = "rock") { + console.log("The computer has chosen " + compyInputB + ". You've lost!") +} +if(stretch = "scissors") && if(compyInputB = "paper") { + console.log("The computer has chosen " + compyInputB + ". You've won!") } // if(compyInputB = "rock" && stretch = "rock"){ From 9b70a14853a21c0ebe6c9c807f60a2c0f6505366 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:53:05 -0700 Subject: [PATCH 19/28] Now it is proper again! --- index.js | 65 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/index.js b/index.js index 46b6e25af..ed5261685 100644 --- a/index.js +++ b/index.js @@ -196,56 +196,65 @@ if(javaGrade >= 0 && javaGrade <= 60){ //Take Rock, Paper, Sissors further //update your rock papers sissors code below to take a prompt from a user using the window object -var stretch = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); -if(stretch = 0) { - stretch = "rock"; + + +let stretchAAA = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); +if(stretchAAA == 0) { + let stretchAAA = "rock"; + console.log("You have entered 0 - rock"); } -if(stretch = 1) { - stretch = "paper"; +if(stretchAAA == 1) { + let stretchAAA = "paper"; + console.log("You have entered 1 - paper"); } -if(stretch = 2) { - stretch = "scissors"; +if(stretchAAA == 2) { + let stretchAAA = "scissors"; + console.log("You have entered 2 - scissors"); } -console.log("You have entered " + stretch + ".") +// console.log("You have entered " + stretchAAA); let compyInputB = Math.floor(Math.random() * 3); -if(compyInputB = 0) { - compyInputB = "rock"; +if(compyInputB == 0) { + let compyInputB = "rock"; + console.log("The computer has randomly chosen 0 - rock"); } -if(compyInputB = 1) { - compyInputB = "paper"; +if(compyInputB == 1) { + let compyInputB = "paper"; + console.log("The computer has randomly chosen 1 - paper"); } -if(compyInputB = 2) { - compyInputB = "scissors"; +if(compyInputB == 2) { + let compyInputB = "scissors"; + console.log("The computer has randomly chosen 2 - scissors"); } +// console.log("The computer has chosen " + compyInputB); -if(stretch = "rock") && if(compyInputB = "paper") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") +if(stretchAAA == 0 && compyInputB == 1) { + console.log("You've lost!") } -if(stretch = "rock") && if(compyInputB = "scissors") { - console.log("The computer has chosen " + compyInputB + ". You've won!") +if(stretchAAA == 0 && compyInputB == 2) { + console.log("You've won!") } -if(stretch = "paper") && if(compyInputB = "rock") { - console.log("The computer has chosen " + compyInputB + ". You've won!") +if(stretchAAA == 1 && compyInputB == 0) { + console.log("You've won!") } -if(stretch = "paper") && if(compyInputB = "scissors") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") +if(stretchAAA == 1 && compyInputB == 2) { + console.log("You've lost!") } -if(stretch = "scissors") && if(compyInputB = "rock") { - console.log("The computer has chosen " + compyInputB + ". You've lost!") +if(stretchAAA == 2 && compyInputB == 0) { + console.log("You've lost!") } -if(stretch = "scissors") && if(compyInputB = "paper") { - console.log("The computer has chosen " + compyInputB + ". You've won!") +if(stretchAAA == 2 && compyInputB == 1) { + console.log("You've won!") } // if(compyInputB = "rock" && stretch = "rock"){ // console.log("Stretch - You win!"); // } -if(compyInputB === stretch){ +if(compyInputB == stretchAAA){ console.log("Stretch - It's a tie!"); } // if(compyInputB >= stretch){ // console.log("Stretch - The computer wins!"); -// } \ No newline at end of file +// } From 176ed597fefe1aeed7e84194c7e83d4d0f1a2c15 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:56:32 -0700 Subject: [PATCH 20/28] Added flavor text to the window prompt --- index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index ed5261685..52edab8f6 100644 --- a/index.js +++ b/index.js @@ -198,55 +198,55 @@ if(javaGrade >= 0 && javaGrade <= 60){ -let stretchAAA = prompt("Choose a number from 0-2. 0 being rock, 1 being paper, and 2 being scissors."); +let stretchAAA = prompt("Let's play Rock, Paper, Scissors! Choose a number from 0-2 where 0 is rock, 1 is paper, and 2 is scissors. Any other value means the computer has played one solo game by itself."); if(stretchAAA == 0) { let stretchAAA = "rock"; - console.log("You have entered 0 - rock"); + console.log("Stretch - You have entered 0 - rock"); } if(stretchAAA == 1) { let stretchAAA = "paper"; - console.log("You have entered 1 - paper"); + console.log("Stretch - You have entered 1 - paper"); } if(stretchAAA == 2) { let stretchAAA = "scissors"; - console.log("You have entered 2 - scissors"); + console.log("Stretch - You have entered 2 - scissors"); } // console.log("You have entered " + stretchAAA); let compyInputB = Math.floor(Math.random() * 3); if(compyInputB == 0) { let compyInputB = "rock"; - console.log("The computer has randomly chosen 0 - rock"); + console.log("Stretch - The computer has randomly chosen 0 - rock"); } if(compyInputB == 1) { let compyInputB = "paper"; - console.log("The computer has randomly chosen 1 - paper"); + console.log("Stretch - The computer has randomly chosen 1 - paper"); } if(compyInputB == 2) { let compyInputB = "scissors"; - console.log("The computer has randomly chosen 2 - scissors"); + console.log("Stretch - The computer has randomly chosen 2 - scissors"); } // console.log("The computer has chosen " + compyInputB); if(stretchAAA == 0 && compyInputB == 1) { - console.log("You've lost!") + console.log("Stretch - You've lost!") } if(stretchAAA == 0 && compyInputB == 2) { - console.log("You've won!") + console.log("Stretch - You've won!") } if(stretchAAA == 1 && compyInputB == 0) { - console.log("You've won!") + console.log("Stretch - You've won!") } if(stretchAAA == 1 && compyInputB == 2) { - console.log("You've lost!") + console.log("Stretch - You've lost!") } if(stretchAAA == 2 && compyInputB == 0) { - console.log("You've lost!") + console.log("Stretch - You've lost!") } if(stretchAAA == 2 && compyInputB == 1) { - console.log("You've won!") + console.log("Stretch - You've won!") } // if(compyInputB = "rock" && stretch = "rock"){ From c8a82b7e9f32bc7ddcf8015f1d65f649292796b9 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 17:57:27 -0700 Subject: [PATCH 21/28] Updated readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ccabffaf0..a3ae15191 100644 --- a/README.md +++ b/README.md @@ -49,15 +49,15 @@ The completion of these questions is mandatory for MVP. However, passing the qui After you have completed the requirements, try any of the following challenges. As always, note that these may require additional research beyond what you learned in this module. -- [ ] See tasks labelled stretch. Please ensure you've completed MVP before you attempt the stretch goals. Note that you may need to look forward to tomorrow's training kit in order to complete the task. +- [x] See tasks labelled stretch. Please ensure you've completed MVP before you attempt the stretch goals. Note that you may need to look forward to tomorrow's training kit in order to complete the task. ## Submission format Follow these steps for completing your project. -1. [ ] Submit a pull request to merge `` branch into master. **Please don't merge your own pull request** -2. [ ] Add your TL as a reviewer on the pull-request -3. [ ] Your TL will count the project as complete by merging the branch back into master +1. [x] Submit a pull request to merge `` branch into master. **Please don't merge your own pull request** +2. [x] Add your TL as a reviewer on the pull-request +3. [x] Your TL will count the project as complete by merging the branch back into master ## Resources From acfba23fbdfd11539ca34ac0d70afbf14de1d331 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Tue, 11 Aug 2020 18:08:10 -0700 Subject: [PATCH 22/28] Changed flavor text of the first rock-paper-scissors task --- index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 52edab8f6..cf387555a 100644 --- a/index.js +++ b/index.js @@ -89,10 +89,6 @@ dogFeeder('X') // use math.random to determine the computers choice // hint while you can complete this with only conditionals based on strings it may help to equate choice to a number -const rock = 0; -const paper = 1; -const scissors = 2; - // let 0 = rock; // let 1 = paper; // let 2 = scissors; @@ -100,13 +96,13 @@ const scissors = 2; let playerinput = 1;// 1 let compyInput = Math.floor(Math.random() * 3); if(compyInput === 0){ - console.log("Computer played rock. You played paper. You win!"); + console.log("For this task, the script is written to output paper. The randomized counter-play is rock. You win!"); } if(compyInput === 1){ - console.log("Computer played paper. You played paper. It's a tie!"); + console.log("For this task, the script is written to output paper. The randomized counter-play is paper. It's a tie!"); } if(compyInput === 2){ - console.log("Computer played scissors. You played paper. The computer wins!"); + console.log("For this task, the script is written to output paper. The randomized counter-play is scissors. The computer wins!"); } // const compyArray = [ @@ -196,7 +192,9 @@ if(javaGrade >= 0 && javaGrade <= 60){ //Take Rock, Paper, Sissors further //update your rock papers sissors code below to take a prompt from a user using the window object - +// Pitfalls +// Equal sign abuse (using =, ==, === interchangeably) +// Thinking if(txt) && (txt) works let stretchAAA = prompt("Let's play Rock, Paper, Scissors! Choose a number from 0-2 where 0 is rock, 1 is paper, and 2 is scissors. Any other value means the computer has played one solo game by itself."); if(stretchAAA == 0) { From 9487c99757571e7f87d90c4d531e7c99a0d6a203 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 07:12:10 -0700 Subject: [PATCH 23/28] Went over things with my mentor last night- forgot to push updates then --- index.js | 129 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 31 deletions(-) diff --git a/index.js b/index.js index cf387555a..e526be02c 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ var votingAge = 21; if(votingAge > 18) { console.log('true'); } - if(votingAge < 18) { + else { console.log('false'); } @@ -16,7 +16,7 @@ var kitty = Math.round(Math.random(0, 1)); console.log('maine coon') } // if(kitty = 0){ - else{ + else { console.log('russian blue') } @@ -29,24 +29,38 @@ console.log(Number('123')); //Task d: Write a function to multiply a*b -let a = 4; -let b = 3; -// function meow(meowMix) { -// return a * b; -// } -console.log(a*b); - +// let a = 4; +// let b = 3; +// // function meow(meowMix) { +// // return a * b; +// // } +// console.log(a*b); +// don't do console! +// won't run in the browser +// need to write logic properly +function multiply(a, b){ + return a * b; +} +console.log(multiply(3,4)); +// this is how I should write the other questions !! +// f(x) I can re-use that I won't!! Write them!! /************************************************************** Task 2 **************************************************************/ //Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years -let age = 28; -let dogYears = 7; -console.log("Wow, I'm " + age*dogYears + " years old in dog years."); +// let age = 28; +// let dogYears = 7; +// console.log("Wow, I'm " + age*dogYears + " years old in dog years."); +// f(x) I can re-use that I won't!! Write them!! +function dogYears2(age){ + console.log("Wow, I'm " + age*7 + " years old in dog years."); +} +dogYears2(28); +// f(x) I can re-use that I won't!! Write them!! /************************************************************** Task 3 **************************************************************/ //Dog feeder @@ -66,7 +80,7 @@ console.log("Wow, I'm " + age*dogYears + " years old in dog years."); // when you are finished invoke your function with the weight of 15 lbs and the age of 1 year - if your calculations are correct your result should be 0.44999999999999996 -let dogWeight = 15; +// let dogWeight = 15; // let dogAge = 1; // function dogFeed(resultMatch) { @@ -75,12 +89,37 @@ let dogWeight = 15; // } // dogFeed(dogWeight); -function dogFeeder(resultMaybe){ - if(resultMaybe === 'X'){ - console.log("Your dog needs " + (dogWeight * 0.03) + " lbs of food.") +//order matters +// function dogFeeder(dogWeight, adultPercent){ +// // if(resultMaybe === 'X'){ +// console.log("Your dog needs " + (dogWeight * adultPercent) + " lbs of food.") +// } + +// dogFeeder(15,0.03); + +function dogFood(dogAge, dogWeight){ + if(dogAge >= 1){ + if(dogWeight <= 5){ + console.log(dogWeight*0.05); + } + else if(dogWeight > 5 && dogWeight <= 10){ + console.log(dogWeight*0.04); + } + else if(dogWeight > 10 && dogWeight <= 15){ + console.log(dogWeight *0.03); + } + else { + console.log(dogWeight * 0.02); + } } + // else { + // return + // } } -dogFeeder('X') +dogFood(1,15); +// don't forget the && !! + + /************************************************************** Task 4 **************************************************************/ // Rock, Paper, Sissors @@ -93,17 +132,37 @@ dogFeeder('X') // let 1 = paper; // let 2 = scissors; -let playerinput = 1;// 1 -let compyInput = Math.floor(Math.random() * 3); -if(compyInput === 0){ - console.log("For this task, the script is written to output paper. The randomized counter-play is rock. You win!"); -} -if(compyInput === 1){ - console.log("For this task, the script is written to output paper. The randomized counter-play is paper. It's a tie!"); -} -if(compyInput === 2){ - console.log("For this task, the script is written to output paper. The randomized counter-play is scissors. The computer wins!"); +// if computer input = 1 = rock +// if input matches, tie + +// let playerinput = 1;// 1 // make this a parameter +// let compyInput = Math.floor(Math.random() * 3); +// if(compyInput === 0){ +// console.log("For this task, the script is written to output paper. The randomized counter-play is rock. You win!"); +// } +// if(compyInput === 1){ +// console.log("For this task, the script is written to output paper. The randomized counter-play is paper. It's a tie!"); +// } +// if(compyInput === 2){ +// console.log("For this task, the script is written to output paper. The randomized counter-play is scissors. The computer wins!"); +// } + +function rockpaperscissors(string){ + if(string === "rock" || "paper" || "scissors"){ + let choice = Math.floor(Math.random() * 2); + if(choice === 1){ + console.log("You won at rock, paper, scissors!"); + } + else { + console.log("You lost at rock, paper, scissors!"); + } + } } +rockpaperscissors("rock"); + + +// Functions! +// Not math / strings // const compyArray = [ // "rock", @@ -129,7 +188,12 @@ let miles = 0.621371; console.log("5 km. converts to " + (kilometer * miles) + "mi.") // answer: 3.10686 miles - +function whomp(kilometers){ + kilometers * 0.621371; + return whomp; +} +whomp(5); +console.log(whomp(5)); //b. Feet to CM - should take the number of feet and convert it to the equal number of centimeters let feet = 5; @@ -146,9 +210,12 @@ console.log("5 ft. converts to " + (feet * centimeters) + "cm.") // the function should take a starting number as an argument and count down - at each iteration it should log (number) bottles of soda on the wall, (number) bottles of soda, take one down pass it around (number left over) bottles of soda on the wall` // function annoyingSong() -for(let i = 99; i > 0; i--){ - console.log("There are " + i + " bottles of soda on the wall. " + i + " bottles of soda. Take one down, pass it around, " + (i-1) + " bottles of soda on the wall."); +function annoyingSong(bottles){ + for(let i = bottles; i > 0; i--){ + console.log("There are " + i + " bottles of soda on the wall. " + i + " bottles of soda. Take one down, pass it around, " + (i-1) + " bottles of soda on the wall."); + } } +annoyingSong(99); @@ -174,7 +241,7 @@ if(javaGrade >= 70 && javaGrade <= 80){ if(javaGrade >= 60 && javaGrade <= 70){ console.log("You got " + javaGrade + " out of 100. You have a D."); } -if(javaGrade >= 0 && javaGrade <= 60){ +else { console.log("You got " + javaGrade + " out of 100. You have a F."); } From fb88a335325f3c22f53911d1d089635b038e0f73 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 08:01:18 -0700 Subject: [PATCH 24/28] Updates during support hours & independent work --- index.js | 81 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 26 deletions(-) diff --git a/index.js b/index.js index e526be02c..86a57babe 100644 --- a/index.js +++ b/index.js @@ -136,26 +136,45 @@ dogFood(1,15); // if input matches, tie // let playerinput = 1;// 1 // make this a parameter -// let compyInput = Math.floor(Math.random() * 3); +// let compyInput = Math.floor(Math.random() * 2); // if(compyInput === 0){ +// return // console.log("For this task, the script is written to output paper. The randomized counter-play is rock. You win!"); // } // if(compyInput === 1){ // console.log("For this task, the script is written to output paper. The randomized counter-play is paper. It's a tie!"); // } -// if(compyInput === 2){ +// else { // console.log("For this task, the script is written to output paper. The randomized counter-play is scissors. The computer wins!"); // } function rockpaperscissors(string){ if(string === "rock" || "paper" || "scissors"){ let choice = Math.floor(Math.random() * 2); - if(choice === 1){ - console.log("You won at rock, paper, scissors!"); + if(choice = 0){ + return "rock"; + console.log("The randomized counter-play is rock."); + } + if(choice = 1){ + return "paper"; + console.log("The randomized counter-play is paper."); } else { - console.log("You lost at rock, paper, scissors!"); + return "scissors"; + console.log("The randomized counter-play is scissors."); } + // if(choice === 1){ + // console.log("You won at rock, paper, scissors!"); + // } + // else { + // console.log("You lost at rock, paper, scissors!"); + + } + if(string === "paper" && choice === "rock"){ + console.log("You win!") + } + else { + console.log("You lose!") } } rockpaperscissors("rock"); @@ -188,12 +207,16 @@ let miles = 0.621371; console.log("5 km. converts to " + (kilometer * miles) + "mi.") // answer: 3.10686 miles -function whomp(kilometers){ - kilometers * 0.621371; - return whomp; + +function kilom(fivrr){ + return fivrr*0.621371; } -whomp(5); -console.log(whomp(5)); +console.log(kilom(5)); + + +// testKilo = (kiloInput) => { +// kiloInput * 0.621371; +// } //b. Feet to CM - should take the number of feet and convert it to the equal number of centimeters let feet = 5; @@ -201,7 +224,10 @@ let centimeters = 30.48; console.log("5 ft. converts to " + (feet * centimeters) + "cm.") // answer: 152.4 cm. - +function feets(cms){ + return cms*30.48; +} +console.log(feets(5)); /************************************************************** Task 6 **************************************************************/ @@ -228,22 +254,25 @@ annoyingSong(99); //70s should be Cs //60s should be D //and anything below 60 should be F -let javaGrade = Math.floor(Math.random() * 101); -if(javaGrade >= 90 && javaGrade <= 101){ - console.log("You got " + javaGrade + " out of 100. You have an A."); -} -if(javaGrade >= 80 && javaGrade <= 90){ - console.log("You got " + javaGrade + " out of 100. You have a B."); -} -if(javaGrade >= 70 && javaGrade <= 80){ - console.log("You got " + javaGrade + " out of 100. You have a C."); -} -if(javaGrade >= 60 && javaGrade <= 70){ - console.log("You got " + javaGrade + " out of 100. You have a D."); -} -else { - console.log("You got " + javaGrade + " out of 100. You have a F."); +function javaGrade(randomize){ + if(randomize >= 90 && randomize <= 101){ + console.log("You got " + randomize + " out of 100. You have an A."); + } + if(randomize >= 80 && randomize <= 90){ + console.log("You got " + randomize + " out of 100. You have a B."); + } + if(randomize >= 70 && randomize <= 80){ + console.log("You got " + randomize + " out of 100. You have a C."); + } + if(randomize >= 60 && randomize <= 70){ + console.log("You got " + randomize + " out of 100. You have a D."); + } + else { + console.log("You got " + randomize + " out of 100. You have a F."); + } } +javaGrade(Math.floor(Math.random() * 101)); + /************************************************************** Stretch **************************************************************/ //Create a function that counts the number of vowels within a string. It should handle both capitalized and uncapitalized vowels. From 20ca83fce081ef6a2f421606425eea676a434b6c Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 08:13:46 -0700 Subject: [PATCH 25/28] finished rock-paper-scissors with a proper f(x) with win/tie/lose conditions defined --- index.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 86a57babe..07f3c42a8 100644 --- a/index.js +++ b/index.js @@ -173,6 +173,15 @@ function rockpaperscissors(string){ if(string === "paper" && choice === "rock"){ console.log("You win!") } + if(string === "rock" && choice === "scissors"){ + console.log("You win!") + } + if(string === "scissors" && choice === "paper"){ + console.log("You win!") + } + if(string === choice){ + console.log("You tie! Whomp, Whomp!") + } else { console.log("You lose!") } @@ -291,18 +300,17 @@ javaGrade(Math.floor(Math.random() * 101)); // Pitfalls // Equal sign abuse (using =, ==, === interchangeably) // Thinking if(txt) && (txt) works - -let stretchAAA = prompt("Let's play Rock, Paper, Scissors! Choose a number from 0-2 where 0 is rock, 1 is paper, and 2 is scissors. Any other value means the computer has played one solo game by itself."); -if(stretchAAA == 0) { - let stretchAAA = "rock"; +function properStretch(popupInput,){ +if(popupInput === 0) { + popupInput = "rock"; console.log("Stretch - You have entered 0 - rock"); } -if(stretchAAA == 1) { - let stretchAAA = "paper"; +if(popupInput === 1) { + popupInput = "paper"; console.log("Stretch - You have entered 1 - paper"); } -if(stretchAAA == 2) { - let stretchAAA = "scissors"; +else { + popupInput === "scissors"; console.log("Stretch - You have entered 2 - scissors"); } // console.log("You have entered " + stretchAAA); @@ -352,3 +360,5 @@ if(compyInputB == stretchAAA){ // if(compyInputB >= stretch){ // console.log("Stretch - The computer wins!"); // } +} +properStretch(prompt("Let's play Rock, Paper, Scissors! Choose a number from 0-2 where 0 is rock, 1 is paper, and 2 is scissors. Any other value means the computer has played one solo game by itself."),) From c97fc1d3b26efcf16313bf54ff56753d9a3d0f70 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 09:25:26 -0700 Subject: [PATCH 26/28] Updated stretch- still need to fix errors but it's a proper function I'd say --- index.js | 124 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 52 deletions(-) diff --git a/index.js b/index.js index 07f3c42a8..422b98a4c 100644 --- a/index.js +++ b/index.js @@ -300,65 +300,85 @@ javaGrade(Math.floor(Math.random() * 101)); // Pitfalls // Equal sign abuse (using =, ==, === interchangeably) // Thinking if(txt) && (txt) works -function properStretch(popupInput,){ -if(popupInput === 0) { - popupInput = "rock"; - console.log("Stretch - You have entered 0 - rock"); -} -if(popupInput === 1) { - popupInput = "paper"; - console.log("Stretch - You have entered 1 - paper"); -} -else { - popupInput === "scissors"; - console.log("Stretch - You have entered 2 - scissors"); -} -// console.log("You have entered " + stretchAAA); +function properStretch(){ + let popupInput = prompt("Let's play Rock, Paper, Scissors! Please enter rock, paper, or scissors below to designate your play"); + if(popupInput === 0) { + popupInput = "rock"; + console.log("Stretch - You have entered 0 - rock"); + } + if(popupInput === 1) { + popupInput = "paper"; + console.log("Stretch - You have entered 1 - paper"); + } + else { + popupInput === "scissors"; + console.log("Stretch - You have entered 2 - scissors"); + } + popupInput = string; + if(popupInput === "rock" || "paper" || "scissors"){ + let choice = Math.floor(Math.random() * 2); + if(choice = 0){ + return "rock"; + console.log("The randomized counter-play is rock."); + } + if(choice = 1){ + return "paper"; + console.log("The randomized counter-play is paper."); + } + else { + return "scissors"; + console.log("The randomized counter-play is scissors."); + } + } + } + if(popupInput === "paper" && choice === "rock"){ + console.log("You win!") + } + if(popupInput === "rock" && choice === "scissors"){ + console.log("You win!") + } + if(popupInput === "scissors" && choice === "paper"){ + console.log("You win!") + } + if(popupInput === choice){ + console.log("You tie! Whomp, Whomp!") + } + else { + console.log("You lose!") + } +properStretch(); + -let compyInputB = Math.floor(Math.random() * 3); -if(compyInputB == 0) { - let compyInputB = "rock"; - console.log("Stretch - The computer has randomly chosen 0 - rock"); -} -if(compyInputB == 1) { - let compyInputB = "paper"; - console.log("Stretch - The computer has randomly chosen 1 - paper"); -} -if(compyInputB == 2) { - let compyInputB = "scissors"; - console.log("Stretch - The computer has randomly chosen 2 - scissors"); -} // console.log("The computer has chosen " + compyInputB); -if(stretchAAA == 0 && compyInputB == 1) { - console.log("Stretch - You've lost!") -} -if(stretchAAA == 0 && compyInputB == 2) { - console.log("Stretch - You've won!") -} +// if(stretchAAA == 0 && compyInputB == 1) { +// console.log("Stretch - You've lost!") +// } +// if(stretchAAA == 0 && compyInputB == 2) { +// console.log("Stretch - You've won!") +// } -if(stretchAAA == 1 && compyInputB == 0) { - console.log("Stretch - You've won!") -} -if(stretchAAA == 1 && compyInputB == 2) { - console.log("Stretch - You've lost!") -} +// if(stretchAAA == 1 && compyInputB == 0) { +// console.log("Stretch - You've won!") +// } +// if(stretchAAA == 1 && compyInputB == 2) { +// console.log("Stretch - You've lost!") +// } -if(stretchAAA == 2 && compyInputB == 0) { - console.log("Stretch - You've lost!") -} -if(stretchAAA == 2 && compyInputB == 1) { - console.log("Stretch - You've won!") -} +// if(stretchAAA == 2 && compyInputB == 0) { +// console.log("Stretch - You've lost!") +// } +// if(stretchAAA == 2 && compyInputB == 1) { +// console.log("Stretch - You've won!") +// } -// if(compyInputB = "rock" && stretch = "rock"){ -// console.log("Stretch - You win!"); +// // if(compyInputB = "rock" && stretch = "rock"){ +// // console.log("Stretch - You win!"); +// // } +// if(compyInputB == stretchAAA){ +// console.log("Stretch - It's a tie!"); // } -if(compyInputB == stretchAAA){ - console.log("Stretch - It's a tie!"); -} // if(compyInputB >= stretch){ // console.log("Stretch - The computer wins!"); // } -} -properStretch(prompt("Let's play Rock, Paper, Scissors! Choose a number from 0-2 where 0 is rock, 1 is paper, and 2 is scissors. Any other value means the computer has played one solo game by itself."),) + \ No newline at end of file From 45ab542828cf1fda552f3fbf2d116f8d322e81f3 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 10:39:04 -0700 Subject: [PATCH 27/28] Added puppy conditions --- index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 422b98a4c..307d41cb9 100644 --- a/index.js +++ b/index.js @@ -112,9 +112,17 @@ function dogFood(dogAge, dogWeight){ console.log(dogWeight * 0.02); } } - // else { - // return - // } + if(dogAge < 1){ + if(dogAge > .2 && dogAge <= .4){ + console.log(dogWeight*0.1); + } + else if(dogAge > .4 && dogAge <= .7){ + console.log(dogWeight*0.05); + } + else { + console.log(dogWeight * 0.04); + } + } } dogFood(1,15); // don't forget the && !! @@ -301,7 +309,7 @@ javaGrade(Math.floor(Math.random() * 101)); // Equal sign abuse (using =, ==, === interchangeably) // Thinking if(txt) && (txt) works function properStretch(){ - let popupInput = prompt("Let's play Rock, Paper, Scissors! Please enter rock, paper, or scissors below to designate your play"); + popupInput = prompt("Let's play Rock, Paper, Scissors! Please enter rock, paper, or scissors below to designate your play"); if(popupInput === 0) { popupInput = "rock"; console.log("Stretch - You have entered 0 - rock"); @@ -314,7 +322,6 @@ function properStretch(){ popupInput === "scissors"; console.log("Stretch - You have entered 2 - scissors"); } - popupInput = string; if(popupInput === "rock" || "paper" || "scissors"){ let choice = Math.floor(Math.random() * 2); if(choice = 0){ From f7a4f55017e6747e2ed1e1e5211d372fb5090c32 Mon Sep 17 00:00:00 2001 From: Jamie Hardesty Date: Thu, 13 Aug 2020 10:40:23 -0700 Subject: [PATCH 28/28] removed an equal sign from randomize conditionals slash ranges --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 307d41cb9..466cfc869 100644 --- a/index.js +++ b/index.js @@ -272,16 +272,16 @@ annoyingSong(99); //60s should be D //and anything below 60 should be F function javaGrade(randomize){ - if(randomize >= 90 && randomize <= 101){ + if(randomize > 90 && randomize <= 101){ console.log("You got " + randomize + " out of 100. You have an A."); } - if(randomize >= 80 && randomize <= 90){ + if(randomize > 80 && randomize <= 90){ console.log("You got " + randomize + " out of 100. You have a B."); } - if(randomize >= 70 && randomize <= 80){ + if(randomize > 70 && randomize <= 80){ console.log("You got " + randomize + " out of 100. You have a C."); } - if(randomize >= 60 && randomize <= 70){ + if(randomize > 60 && randomize <= 70){ console.log("You got " + randomize + " out of 100. You have a D."); } else {