From a49735a380fe080a6ccc11f294777836a8268707 Mon Sep 17 00:00:00 2001 From: jeremyking1996 <73255406+jeremyking1996@users.noreply.github.com> Date: Tue, 24 Nov 2020 14:40:24 -0500 Subject: [PATCH] Finished formulas --- .DS_Store | Bin 6148 -> 6148 bytes js/formulas.js | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.DS_Store b/.DS_Store index cd0c326c3aa555d987177b0b5ba76bbe28db37ae..c9243500e2b2f9944a5d964769bc4a113e2e220e 100644 GIT binary patch delta 348 zcmZoMXfc=|#>B)qu~2NHo+2a1#DLw4A22d9a!lr7)TvJ@FD^*R$xmWnVECF;kds+l zVqkECk%^gwm5rT)lZ%^^n~$3_HaH`{Jh&vWq_o&6u_#_ZCO9)CH7T(uJTs*vBP2D? zH7B(!HP64uC$S{8C>o?VBtJg~r~txFObW|PEsqxvan8>xNzBYkEdrYdGNV4RC?-5J zFD1X+DZex?r5LOMYC4!5kXVudG>AjlA)x{2Mg|5>4$gQ1iRx-&V^bXkV-w?A9ffLh za|0a(6JxX5T22lQNp-iNxYDM+S+kccUAFwtVX!U+Mn(wDAPA))6f*B`mu~2NHo+2aL#DLw5Y?FDIbS678CvV=t?9Z}^MV4tZI|n}pP}Sy- Y%-@+O^NUz=FaQA~0|V3M0Ff=s0Dm_SrT_o{ diff --git a/js/formulas.js b/js/formulas.js index 2435d53..995eabc 100644 --- a/js/formulas.js +++ b/js/formulas.js @@ -1,80 +1,84 @@ -// Basic math formulaas -function addition(num1, num2){ - return -1; -} +function addition(num1, num2) { + +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 function areaSquare(side){ - return -1; + + return 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 base * height / 2; } function Circle(radius){ - return -1; + return Math.PI * radius**2; } function Sphere(radius){ - return -1; + return 4 * Math.PI * radius**2; } // Surface Area formulas function surfaceAreaCube(side){ - return -1; + return 6 * side * side ; } function surfaceAreaCylinder(radius, height){ - return -1; + return (4 * Math.PI * radius * height) * (2 * Math.PI * radius**2); } // Perimeter formulas function perimeterSquare(side){ - return -1; + return side + side + side + side; } function perimeterRectangle(length, height){ - return -1; + return length + height + length + height; } 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 side**3; } function volumeRectangular(length, width, height){ - return -1; + return length * width * height; } function volumeCylinder(radius, height){ - return -1; + return Math.PI * radius**2 * height; }