From b0c2c3839192a4eacc50afe3eb9f2c4b9cf3104c Mon Sep 17 00:00:00 2001 From: Crowe0331 <73245384+Crowe0331@users.noreply.github.com> Date: Wed, 18 Nov 2020 11:28:40 -0500 Subject: [PATCH 1/2] RSS-JS-Basics --- RR-JS-Basics/README.md | 71 +++++++++++++++++++++++++ RR-JS-Basics/index.html | 16 ++++++ RR-JS-Basics/js/formulas.js | 100 ++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 RR-JS-Basics/README.md create mode 100644 RR-JS-Basics/index.html create mode 100644 RR-JS-Basics/js/formulas.js diff --git a/RR-JS-Basics/README.md b/RR-JS-Basics/README.md new file mode 100644 index 0000000..18ddc04 --- /dev/null +++ b/RR-JS-Basics/README.md @@ -0,0 +1,71 @@ +# Work Assignment - JavaScript Basics + +## Tech Stack +A list of expected technology to be used in this assignment + +* IDE +* JavaScript +* Terminal +* Git +* Web Browser + +## Assignment +Using your knowledge of javascript basics, complete the provided methods to return the proper values. Use the browser Development Tools to run the commands + +## Requirements + +Several functions have been provided for you in the JavaScript document. You must provide the logic to complete the function. + +The formulas are divided into 5 sections: + +### Basic Math + +| Formula | Equation | Description | +| ------- | -------- | ----------- | +| Addition | a + b | a & b are any real number | +| Subtraction | a - b | a & b are any real number | +| Multiplication | a * b | a & b are any real number | +| Division | a / b | a & b are any real number | + +### Area + +| Formula | Equation | Description | +| ------- | -------- | ----------- | +| Square | A = s2 | where s = any side of the square | +| Rectangle | A = lw | where l = length and w = width | +| Parallelogram | A = bh | where b = base and h = height | +| Triangle | A = (1/2)bh| where b = base and h = height | +| Circle | A = π r2 | where π = 3.14 and r = radius | +| Sphere | S = 4 π r2 | where s = Surface area | + +### Surface Area + +| Formula | Equation | Description | +| ------- | -------- | ----------- | +| Cube | SA = 6s2 | where s = any side | +| Cylinder (lateral) | SA = 2 π r h | where π = 3.14, r = radius, and h = height | + +### Perimeter + +| Formula | Equation | Description | +| ------- | -------- | ----------- | +| Square | P = 4s | where s = any side | +| Rectangle | P = 2l + 2w | where l = length and w = width | +| Triangle | P = s1 + s2 + s3 | where s = a side | +| Circle | C = π d | where π = 3.14 and d = diameter | + +### Volume + +| Formula | Equation | Description | +| ------- | -------- | ----------- | +| Cube | V = S3 | where S = any side | +| Rectangular Container | V = lwh | where l = length, w = width, and h = height | +| Cylinder | V = π r2h | where π= 3.14, r = radius, and h = height | + +## Instructions + +1. Fork and clone the repository as usual +2. Open the lab in your favored IDE +3. Complete the functions to return the proper values +4. Open a browser and use the Dev Tools to test your +5. After all functions are complete, push to GitHub and create a pull request diff --git a/RR-JS-Basics/index.html b/RR-JS-Basics/index.html new file mode 100644 index 0000000..d66c928 --- /dev/null +++ b/RR-JS-Basics/index.html @@ -0,0 +1,16 @@ + + + + + Basic Formulas + + + +

Basic Formulas

+
    +
  1. Open Developer Tools
  2. +
  3. Select the Console Tab
  4. +
  5. Begin typing JS functions to test output
  6. +
+ + diff --git a/RR-JS-Basics/js/formulas.js b/RR-JS-Basics/js/formulas.js new file mode 100644 index 0000000..b15170d --- /dev/null +++ b/RR-JS-Basics/js/formulas.js @@ -0,0 +1,100 @@ +// Basic math formulaas +function addition(num1, num2){ + let sum = num1 + num2; + return sum; +} + +function subtraction(num1, num2){ + let difference = num1 - num2; + return difference; +} + +function multiplication(num1, num2){ + let product = num1 * num2; + return product; +} + +function division(num1, num2){ + let quotient = num1 / num2; + return quotient; +} + +// Area formulaas +function areaSquare(side){ + let areaSquare = Math.pow(side, 2); + return areaSquare; +} + +function areaRectangle(length, width){ + let areaRectangle = length * width; + return areaRectangle; +} + +function areaParallelogram(base, height){ + let areaParallelogram = base * height; + return areaParallelogram; +} + +function areaTriangle(base, height){ + let areaTriangle = (1/2) * base * height; + return areaTriangle; +} + +//Did not use Math.PI because it resulted in slightly different numbers from using 3.14 on the directions page. +function Circle(radius){ + let Circle = Math.pow(radius, 2) * 3.14; + return Circle; +} + +function Sphere(radius){ + let Sphere = 4 * 3.14 * Math.pow(radius, 2); + return Sphere; +} + +// Surface Area formulas +function surfaceAreaCube(side){ + let areaCube = Math.pow(side, 2) * 6; + return areaCube; +} + +function surfaceAreaCylinder(radius, height){ + let = areaCylinder = 2 * 3.14 * radius * height; + return areaCylinder; +} + +// Perimeter formulas +function perimeterSquare(side){ + let perimeterSquare = 4 * side; + return perimeterSquare; +} + +function perimeterRectangle(length, height){ + let perimeterRectangle = (2 * length) + (2 * height); + return perimeterRectangle; +} + +function perimeterTriangle(side1, side2, side3){ + let perimeterTriangle = side1 + side2 +side3; + return perimeterTriangle; +} + +function perimeterCircle(diameter){ + let perimeterCircle= 3.14 * diameter; + return perimeterCircle; +} + +// Volume formulas +function volumeCube(side){ + let volumeCube = Math.pow(side, 3); + return volumeCube; +} + +function volumeRectangular(length, width, height){ + let volumeRectangular = length * width * height; + return volumeRectangular; +} + +function volumeCylinder(radius, height){ + let volumeCylinder = 3.14 * Math.pow(radius, 2) * height; + return volumeCylinder; +} From 5b800d58375b46bbb2427c271516ce1bb7c58ff2 Mon Sep 17 00:00:00 2001 From: Crowe0331 <73245384+Crowe0331@users.noreply.github.com> Date: Sun, 22 Nov 2020 17:40:35 -0500 Subject: [PATCH 2/2] Add files via upload