From 0c73656a501ee31f7ab1121b699123c329675c25 Mon Sep 17 00:00:00 2001 From: Nick Satinover Date: Wed, 16 Dec 2020 18:51:41 -0500 Subject: [PATCH 1/2] function perimeterRectangle(length, width) - changed width from height --- js/formulas.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index 2435d53..a50cd88 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -1,61 +1,61 @@ -// Basic math formulaas +// Basic math formulas function addition(num1, num2){ - return -1; + return num1 + num2; } function subtraction(num1, num2){ - return -1; + return num1 - num2; } function multiplication(num1, num2){ - return -1; + return num1 * num2; } function division(num1, num2){ - return -1; + return num1 / num2; } -// Area formulaas +// Area formulas function areaSquare(side){ - return -1; + return Math.pow(side, 2); } function areaRectangle(length, width){ - return -1; + return length * width; } function areaParallelogram(base, height){ - return -1; + return base * height; } function areaTriangle(base, height){ - return -1; + return (1 / 2) * (base * height); } function Circle(radius){ - return -1; + return Math.PI(Math.pow(radius, 2)); } function Sphere(radius){ - return -1; + return 4 * Math.PI * (Math.pow(radius, 3) / 3); } // 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; +function perimeterRectangle(length, width){ + return (2 * length) + (2 * width); } function perimeterTriangle(side1, side2, side3){ From a9688694ebab7c0e8848fc1096b91747a80f1f11 Mon Sep 17 00:00:00 2001 From: Nick Satinover Date: Wed, 16 Dec 2020 20:40:49 -0500 Subject: [PATCH 2/2] completed --- js/formulas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/formulas.js b/js/formulas.js index a50cd88..28761d4 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -37,7 +37,7 @@ function Circle(radius){ } function Sphere(radius){ - return 4 * Math.PI * (Math.pow(radius, 3) / 3); + return 4 * Math.PI * Math.pow(radius, 2); } // Surface Area formulas @@ -59,22 +59,22 @@ function perimeterRectangle(length, 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; }