From 7f272185ac030de413b7551463b7987c20c3947a Mon Sep 17 00:00:00 2001 From: andres ballares Date: Mon, 7 Dec 2020 21:25:22 -0500 Subject: [PATCH 01/11] problem 1 --- problems/variables.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/problems/variables.js b/problems/variables.js index 831a97c..1527072 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -7,6 +7,17 @@ // * For example, if you were born in 1988, then in 2026 you'll be either 37 or 38, depending on what month it is in 2026. // * Log them to the screen like so: "I will be either `ageMin` or `ageMax` in `futureYear`", substituting the values. +let birthYear = '1977' +let futureYear = '2021' +let minimumAge = '44' +let maximumAge = '45' +console.log("I will be either " + minimumAge + " or " + maximumAge + " in " + futureYear) + + + + + + // ## Problem Two // Snack Supply Calculator: From bef3f65ed35eeaa83ff5e79719e74bb5834521a7 Mon Sep 17 00:00:00 2001 From: Cari Date: Mon, 7 Dec 2020 21:39:02 -0500 Subject: [PATCH 02/11] Added problem 2 --- problems/variables.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/problems/variables.js b/problems/variables.js index 1527072..66ab53c 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -27,8 +27,13 @@ console.log("I will be either " + minimumAge + " or " + maximumAge + " i // * Calculate how many snacks you would eat total, from your current age until the maximum age. // * Log the result to the screen like this: "You will need `snackNumber` to last you until the age of `maxAge`". -// ## Problem Three +let curAge = "30" +const maxAge = "99" +let snackCount = "3" +let snackNumber = ((maxAge - curAge)*(snackCount * 365)) +console.log("You will need "+snackNumber+ " to last you until the age of "+maxAge) +// ## Problem Three // Calculate properties of a circle, using the definitions: http://math2.org/math/geometry/circles.htm // * Store a radius into a variable. // * Calculate the circumference based on the radius, and log "The circumference is `circumferenceResult`". From 2f4b7decbec0b717f12a6818be308e0358bb6410 Mon Sep 17 00:00:00 2001 From: andres ballares Date: Mon, 7 Dec 2020 21:53:23 -0500 Subject: [PATCH 03/11] nothing happen --- problems/variables.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/problems/variables.js b/problems/variables.js index 1527072..ce7abaa 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -27,6 +27,8 @@ console.log("I will be either " + minimumAge + " or " + maximumAge + " i // * Calculate how many snacks you would eat total, from your current age until the maximum age. // * Log the result to the screen like this: "You will need `snackNumber` to last you until the age of `maxAge`". + + // ## Problem Three // Calculate properties of a circle, using the definitions: http://math2.org/math/geometry/circles.htm @@ -35,6 +37,8 @@ console.log("I will be either " + minimumAge + " or " + maximumAge + " i // * Calculate the area based on the radius, and log "The area is `areaOfCircle`". // * Hint: https://www.w3schools.com/jsref/jsref_pi.asp +gi + // ## Problem Four // Temperature Converter: From d52e9da649fe630c6637da7b1c03a052ce752a0e Mon Sep 17 00:00:00 2001 From: Cari Date: Tue, 8 Dec 2020 19:19:23 -0500 Subject: [PATCH 04/11] nothing. --- problems/variables.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/problems/variables.js b/problems/variables.js index 66ab53c..c0cc7f5 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -40,6 +40,8 @@ console.log("You will need "+snackNumber+ " to last you until the age of "+maxAg // * Calculate the area based on the radius, and log "The area is `areaOfCircle`". // * Hint: https://www.w3schools.com/jsref/jsref_pi.asp +pi * 7 + // ## Problem Four // Temperature Converter: From 7f3b073ce8eef01fb1072be9ab78f3544f5fe5a9 Mon Sep 17 00:00:00 2001 From: andres ballares Date: Tue, 8 Dec 2020 19:49:42 -0500 Subject: [PATCH 05/11] nothing happen --- problems/variables.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/problems/variables.js b/problems/variables.js index b854318..35af0ef 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -37,8 +37,7 @@ console.log("You will need "+snackNumber+ " snacks to last you, until the age of // * Calculate the area based on the radius, and log "The area is `areaOfCircle`". // * Hint: https://www.w3schools.com/jsref/jsref_pi.asp -let radius = "7" -let circumferenceofcircle = "(pi * radius)" + // ## Problem Four From 37319d2c7763cde981973cfd1778710c4ce3df6c Mon Sep 17 00:00:00 2001 From: Cari Date: Tue, 8 Dec 2020 20:02:49 -0500 Subject: [PATCH 06/11] nada --- problems/variables.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/problems/variables.js b/problems/variables.js index ebd6cf6..8c7e08d 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -69,6 +69,8 @@ console.log("Same as, if we convert " + fahrenheit + " into celsius, we would // * Find the average grade of all students // * Print out if Dee's grade is higher than the class average +let aliceGrade = "80%" + // ## Problem Six // Find the last number: From f7d568bce590f13b541f12703971708062be17e2 Mon Sep 17 00:00:00 2001 From: andres ballares Date: Tue, 8 Dec 2020 20:34:32 -0500 Subject: [PATCH 07/11] problem 5 --- problems/variables.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/problems/variables.js b/problems/variables.js index 9c4b7f9..077470a 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -37,16 +37,13 @@ console.log("You will need "+snackNumber+ " snacks to last you, until the age of // * Calculate the area based on the radius, and log "The area is `areaOfCircle`". // * Hint: https://www.w3schools.com/jsref/jsref_pi.asp -<<<<<<< HEAD -======= let radius = "2" let circumferenceOfCircle = Math.PI * radius let areaOfCircle = Math.PI * (radius * 2) console.log("The circumference is " +circumferenceOfCircle) console.log("The area is " +areaOfCircle +".") ->>>>>>> 628490bd8fd766b3f82870af974f8f66da509a8c // ## Problem Four // Temperature Converter: @@ -63,6 +60,9 @@ celsius = "1C°" console.log("Same as, if we convert " + fahrenheit + " into celsius, we would get " + celsius+".") + + + // ## Problem Five // Grades Calculator: @@ -74,6 +74,17 @@ console.log("Same as, if we convert " + fahrenheit + " into celsius, we would // * Find the average grade of all students // * Print out if Dee's grade is higher than the class average +let alice = 70 +let bob = 50 +let cam = 30 +let average = (bob + cam + alice) / 3 +console.log(' The averages of all students is ' + average) +let dee = 90 +average = (bob + cam + alice + dee) / 4 +console.log ( ' The new average of the all students is ' + average) +if(dee > average ) console.log("Dees grade is higher than average") + + // ## Problem Six // Find the last number: From 9657452b5e85faf7b31aabc6c8a0c246df47ff55 Mon Sep 17 00:00:00 2001 From: andres ballares Date: Tue, 8 Dec 2020 23:32:39 -0500 Subject: [PATCH 08/11] finish solving problems --- problems/variables.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/problems/variables.js b/problems/variables.js index 3aa2fa0..ec0e0c8 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -130,6 +130,12 @@ console.log(lastLetter) // * alice + x = y * (bob + x) // * Solve for alice + x = 3 + y = 2 + bob = 12 + alice = (y * (bob + x)- x) +console.log(alice) + // ## Problem Eight // * Cat and Dog Percentages @@ -143,6 +149,12 @@ console.log(lastLetter) // * 25% of the daycare animals are cats // * 75% of the daycare animals are dogs +let numberOfCats = 100 +let numberOfDogs = 150 +let percentageOfCats = (numberOfCats/(numberOfDogs + numberOfCats))* 100 +let percentageOfDogs = (numberOfDogs/(numberOfDogs + numberOfCats))* 100 +console.log( + percentageOfCats + "% of the daycare animals are cats and " + percentageOfDogs + "% of the daycare animals are dogs") + // ## Problem Nine // * Leap Year Calculator @@ -166,13 +178,26 @@ console.log(lastLetter) // let num3 = num1 * num2 // console.log(num3) // ``` +// 10 + +let num1 = 2 +let num2 = 5 +let num3 = num1 * num2 +console.log(num3) // b. + // ```js // let str = 'jel' // str += 'lo' // console.log(str) // ``` +// "jello" + +let str = 'jel' +str += 'lo' +console.log(str) + // c. // ```js @@ -181,5 +206,11 @@ console.log(lastLetter) // let sentence = string + number // console.log(typeof(sentence)) // ``` +// "My favorite number is 42" +// string +let string = 'My favorite number is'; +let number = 42 +let sentence = string + number +console.log(typeof(sentence)) From 064750c708968b613c6fe7b1518c6cd396c0ae0e Mon Sep 17 00:00:00 2001 From: andres ballares Date: Sat, 2 Jan 2021 14:03:10 -0500 Subject: [PATCH 09/11] modifie strings to numbers --- problems/variables.js | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/problems/variables.js b/problems/variables.js index ec0e0c8..e82d5b1 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -7,14 +7,15 @@ // * For example, if you were born in 1988, then in 2026 you'll be either 37 or 38, depending on what month it is in 2026. // * Log them to the screen like so: "I will be either `ageMin` or `ageMax` in `futureYear`", substituting the values. -let birthYear = '1977' -let futureYear = '2021' -let minimumAge = '44' -let maximumAge = '45' +const birthYear = 1977 +let futureYear = 2021 +let minimumAge = 44 +let maximumAge = 45 console.log("I will be either " + minimumAge + " or " + maximumAge + " in " + futureYear) // ## Problem Two + // Snack Supply Calculator: // * Store your current age in a variable. // * Store a maximum age in a constant variable. @@ -22,9 +23,9 @@ console.log("I will be either " + minimumAge + " or " + maximumAge + " i // * Calculate how many snacks you would eat total, from your current age until the maximum age. // * Log the result to the screen like this: "You will need `snackNumber` to last you until the age of `maxAge`". -let curAge = "30" -const maxAge = "99" -let snackCount = "3" +let curAge = 30 +const maxAge = 99 +let snackCount = 3 let snackNumber = ((maxAge - curAge)*(snackCount * 365)) console.log("You will need "+snackNumber+ " snacks to last you, until the age of "+maxAge) @@ -39,11 +40,13 @@ console.log("You will need "+snackNumber+ " snacks to last you, until the age of -let radius = "2" +let radius = 2 let circumferenceOfCircle = Math.PI * radius let areaOfCircle = Math.PI * (radius * 2) console.log("The circumference is " +circumferenceOfCircle) console.log("The area is " +areaOfCircle +".") + + // ## Problem Four // Temperature Converter: @@ -52,9 +55,10 @@ console.log("The area is " +areaOfCircle +".") // * Now store a fahrenheit temperature into a variable. // * Convert it to celsius and output "`tempInFahrenheit`°F is `tempInCelsius`°C." -let celsius = "23C°" +let celsius = 23 +let celsiusToFahrenheit = (celsius * 9/5) + 32 let fahrenheit = "73F°" -console.log("if we were to convert " + celsius + " to Fahrenheit, we would get " + fahrenheit+".") +console.log(celsius + " is " + celsiusToFahrenheit+".") fahrenheit = "34F°" celsius = "1C°" console.log("Same as, if we convert " + fahrenheit + " into celsius, we would get " + celsius+".") @@ -94,14 +98,11 @@ if(dee > average ) console.log("Dees grade is higher than average") // * Output: // * 3 -let a = "584" -let output = a[a.length-1] +let a = 123 +let output = 123 % 10 console.log(output) -let name = "Andres" -let lastLetter = name[name.length-1] -console.log(name.length) -console.log(lastLetter) + // Hint: // Use the remainder % operator. @@ -118,6 +119,14 @@ console.log(lastLetter) // * Expected values: // * alice = 27 // + +x = 3 +y = 2 +bob = 12 +alice = (y * (bob + x)- x) +console.log(alice) + + // * Example 2 // * Input: // * x = 1 @@ -130,12 +139,15 @@ console.log(lastLetter) // * alice + x = y * (bob + x) // * Solve for alice - x = 3 - y = 2 - bob = 12 - alice = (y * (bob + x)- x) +x = 1 +y = 3 +bob = 12 +alice = (y * (bob + x)- x) console.log(alice) + + + // ## Problem Eight // * Cat and Dog Percentages From 3a59cc673391c7320abda8f80028e613f1a1433e Mon Sep 17 00:00:00 2001 From: andres ballares Date: Sun, 3 Jan 2021 04:25:13 -0500 Subject: [PATCH 10/11] solve problems --- problems/variables.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/problems/variables.js b/problems/variables.js index e82d5b1..56152c9 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -57,11 +57,13 @@ console.log("The area is " +areaOfCircle +".") let celsius = 23 let celsiusToFahrenheit = (celsius * 9/5) + 32 -let fahrenheit = "73F°" -console.log(celsius + " is " + celsiusToFahrenheit+".") -fahrenheit = "34F°" -celsius = "1C°" -console.log("Same as, if we convert " + fahrenheit + " into celsius, we would get " + celsius+".") + +console.log(celsius+"°C" + " is " + celsiusToFahrenheit+"°F.") + +fahrenheit = 90.5 +let fahrenheitToCelsius = (fahrenheit - 32) * 5/9 + +console.log(fahrenheit+"°F is " + fahrenheitToCelsius +"°C.") From 89417015cece32c0c9cc9d97f14ac8fd388e79c2 Mon Sep 17 00:00:00 2001 From: andres ballares Date: Sun, 3 Jan 2021 04:53:40 -0500 Subject: [PATCH 11/11] double checking areaOfCircle --- problems/variables.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/problems/variables.js b/problems/variables.js index 56152c9..45dee2f 100644 --- a/problems/variables.js +++ b/problems/variables.js @@ -41,8 +41,9 @@ console.log("You will need "+snackNumber+ " snacks to last you, until the age of let radius = 2 -let circumferenceOfCircle = Math.PI * radius +let circumferenceOfCircle = Math.PI * (radius + radius) let areaOfCircle = Math.PI * (radius * 2) + console.log("The circumference is " +circumferenceOfCircle) console.log("The area is " +areaOfCircle +".")