diff --git a/js/formulas.js b/js/formulas.js index 2435d53..076c906 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -1,80 +1,102 @@ // Basic math formulaas function addition(num1, num2){ - return -1; + let sum = num1 + num2; + return sum; } + function subtraction(num1, num2){ - return -1; + let difference = num1 - num2; + return difference; } -function multiplication(num1, num2){ - return -1; +function multiplication(num1, num2) { +let acc = num1*num2; + return acc; + } function division(num1, num2){ - return -1; + let div = num1/num2; + return div; } // Area formulaas function areaSquare(side){ - return -1; +let A = side*side; + return A; } function areaRectangle(length, width){ - return -1; + let Rectangle = length*width; + return Rectangle; } - function areaParallelogram(base, height){ - return -1; + let Parallelogram = base*height; + return Parallelogram; } function areaTriangle(base, height){ - return -1; + let Triangle = base*height*.5; + return Triangle; } function Circle(radius){ - return -1; + let Circle = Math.PI * radius * radius; + return Circle; } function Sphere(radius){ - return -1; + let Sphere=4*Math.PI*radius*radius; + return Sphere; } // Surface Area formulas function surfaceAreaCube(side){ - return -1; + let B=side*side*6; + return B } function surfaceAreaCylinder(radius, height){ - return -1; + let Cylinder = radius*height*Math.PI*2; + return Cylinder } // Perimeter formulas -function perimeterSquare(side){ - return -1; +function perimeterSquare(side) { +let PS = 4*side; + return PS } function perimeterRectangle(length, height){ - return -1; + let PR = 2*length+ 2*height; + return PR } -function perimeterTriangle(side1, side2, side3){ - return -1; +function perimeterTriangle(side1, side2, side3){ + let PT = side1 + side2 + side3; + return PT + + } function perimeterCircle(diameter){ - return -1; + let PC = diameter*Math.PI; + return PC } // Volume formulas function volumeCube(side){ - return -1; + let VC=side*side*side; + return VC } function volumeRectangular(length, width, height){ - return -1; + let VR = length*width*height; + return VR } function volumeCylinder(radius, height){ - return -1; + VC = Math.PI*radius*radius*height; + return VC }