From 12ab246979317d6404246008ed4b231c01fc4ccb Mon Sep 17 00:00:00 2001 From: CWilliams75 Date: Wed, 25 Nov 2020 19:47:25 -0500 Subject: [PATCH 1/4] basic math formulas --- js/formulas.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index 2435d53..6cd584a 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -1,19 +1,29 @@ // Basic math formulaas function addition(num1, num2){ - return -1; + return num1 + num2; } +//let sum = addition(23, 47); +//console.log (sum); function subtraction(num1, num2){ - return -1; + return num1 - num2; } +//let sum = subtraction(23, 47); +//console.log (sum); function multiplication(num1, num2){ - return -1; + return num1 * num2; } +//let sum = multiplication(23, 47); +//console.log (sum); function division(num1, num2){ - return -1; + return num1 / num2; } +let sum = division(23, 47); +console.log (sum); + + // Area formulaas function areaSquare(side){ From df7ee83173b51175f7093dd299f705221cfb493c Mon Sep 17 00:00:00 2001 From: CWilliams75 Date: Sat, 28 Nov 2020 14:23:26 -0500 Subject: [PATCH 2/4] Area formulas --- js/formulas.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index 6cd584a..2d37a1d 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -20,19 +20,25 @@ function multiplication(num1, num2){ function division(num1, num2){ return num1 / num2; } -let sum = division(23, 47); -console.log (sum); +//let sum = division(23, 47); +//console.log (sum); // Area formulaas function areaSquare(side){ - return -1; + return side * side; } +//let side = areaSquare(2); +//console.log (side); + function areaRectangle(length, width){ - return -1; + return length * width; } + // let area = areaRectangle(25, 75); + //console.log (area); + function areaParallelogram(base, height){ return -1; From 6b7814014bee052bc6f4ad3d5c0fef112a1ddb59 Mon Sep 17 00:00:00 2001 From: CWilliams75 Date: Sat, 28 Nov 2020 14:40:00 -0500 Subject: [PATCH 3/4] Perimeter formulas --- js/formulas.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index 2d37a1d..1952943 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -41,45 +41,45 @@ function areaRectangle(length, width){ function areaParallelogram(base, height){ - return -1; + return base * height; } function areaTriangle(base, height){ - return -1; + return (base * height) / 2; } function Circle(radius){ - return -1; + return Math.pow(radius, 2) * Math.PI; } function Sphere(radius){ - return -1; + return 4 * Math.PI * Math.pow(radius, 2); } // 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 * height); } function perimeterTriangle(side1, side2, side3){ - return -1; + return side1 + side2 + side3; } function perimeterCircle(diameter){ - return -1; + return Math.PI * diameter; } // Volume formulas From a91a6ff8c3dff0bd424ead1b28fc64e201643d6a Mon Sep 17 00:00:00 2001 From: CWilliams75 Date: Sat, 28 Nov 2020 14:43:14 -0500 Subject: [PATCH 4/4] Volume formulas --- js/formulas.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index 1952943..7c31ddf 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -84,13 +84,13 @@ function perimeterCircle(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; }