diff --git a/index.html b/index.html index d66c928..d93de87 100644 --- a/index.html +++ b/index.html @@ -12,5 +12,6 @@

Basic Formulas

  • Select the Console Tab
  • Begin typing JS functions to test output
  • + diff --git a/js/formulas.js b/js/formulas.js index 2435d53..bfd4459 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -1,80 +1,86 @@ // Basic math formulaas function addition(num1, num2){ - return -1; -} + return num1 + num2;} +addition(2, 3) function subtraction(num1, num2){ - return -1; -} + return num1 - num2;} +subtraction(5,3) function multiplication(num1, num2){ - return -1; -} + return num1 * num2;} + multiplication(5, 5) function division(num1, num2){ - return -1; -} + return num1 / num2;} + division(36, 3) // Area formulaas -function areaSquare(side){ - return -1; -} +function areaSquare(num){ + let a = (num * num * num * num) + return a;} + areaSquare(2) + function areaRectangle(length, width){ - return -1; -} + return length * width;} + areaRectangle(6,4) function areaParallelogram(base, height){ - return -1; + return base * height; } + areaParallelogram(8,4) function areaTriangle(base, height){ - return -1; + return .5 * base * height; } + areaTriangle(6,8) -function Circle(radius){ - return -1; +function Circle(radius) { + return (radius * radius * Math.PI); + radius(10) } function Sphere(radius){ - return -1; + return (4 * Math.PI * (radius * radius)); } +radius(8) // Surface Area formulas function surfaceAreaCube(side){ - return -1; + return 6(Math.pow(side,2)); } function surfaceAreaCylinder(radius, height){ - return -1; + return 2 * Math.PI * radius * height; } // Perimeter formulas function perimeterSquare(side){ - return -1; + return 4(side); } function perimeterRectangle(length, height){ - return -1; + return 2(length) + 2(width); } function perimeterTriangle(side1, side2, side3){ - return -1; + return side1 + side2 + side3; } function perimeterCircle(diameter){ - return -1; + return Math.PI * diameter; } // Volume formulas function volumeCube(side){ - return -1; + return Math.pow(side,3); } function volumeRectangular(length, width, height){ - return -1; + return length * width * height; } function volumeCylinder(radius, height){ - return -1; + return Math.PI * Math.pow(radius,2) * height; } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..78c6f34 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "rr-js-basics", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "rr-js-basics", + "version": "1.0.0", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8538d2a --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "rr-js-basics", + "version": "1.0.0", + "description": "## Tech Stack A list of expected technology to be used in this assignment", + "main": "index.js", + "scripts": { + "test": "npm test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/kcee917/RR-JS-Basics.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/kcee917/RR-JS-Basics/issues" + }, + "homepage": "https://github.com/kcee917/RR-JS-Basics#readme" +}