11/*
2- Calculate the volume of the shapes
3-
4- Volume for Cuboid
5- Volume for Cube
6- Volume for Cone
7- Volume for Pyramid
8- Volume for Cylinder
9- Volume for Triangular Prism
10- Volume for Pentagonal Prism
11- Volume for Sphere
12- Volume for Hemisphere
13- */
2+ Calculate the volume of the shapes
3+
4+ Volume for Cuboid
5+ Volume for Cube
6+ Volume for Cone
7+ Volume for Pyramid
8+ Volume for Cylinder
9+ Volume for Triangular Prism
10+ Volume for Pentagonal Prism
11+ Volume for Sphere
12+ Volume for Hemisphere
13+ */
1414
1515/*
1616 Calculate the volume for a Cuboid
@@ -42,7 +42,7 @@ const volCube = (length) => {
4242const volCone = ( radius , height ) => {
4343 isNumber ( radius , 'Radius' )
4444 isNumber ( height , 'Height' )
45- return ( Math . PI * radius ** 2 * height / 3.0 )
45+ return ( Math . PI * radius ** 2 * height / 3.0 )
4646}
4747
4848/*
@@ -54,7 +54,7 @@ const volPyramid = (baseLength, baseWidth, height) => {
5454 isNumber ( baseLength , 'BaseLength' )
5555 isNumber ( baseWidth , 'BaseWidth' )
5656 isNumber ( height , 'Height' )
57- return ( baseLength * baseWidth * height ) / 3.0
57+ return ( baseLength * baseWidth * height ) / 3.0
5858}
5959
6060/*
@@ -71,7 +71,7 @@ const volCylinder = (radius, height) => {
7171/*
7272 Calculate the volume for a Triangular Prism
7373 Reference: http://lrd.kangan.edu.au/numbers/content/03_volume/04_page.htm
74- return 1 / 2 * baseLengthTriangle * heightTriangle * height
74+ return 1 / 2 * baseLengthTriangle * heightTriangle * height
7575*/
7676const volTriangularPrism = ( baseLengthTriangle , heightTriangle , height ) => {
7777 isNumber ( baseLengthTriangle , 'BaseLengthTriangle' )
@@ -89,7 +89,7 @@ const volPentagonalPrism = (pentagonalLength, pentagonalBaseLength, height) => {
8989 isNumber ( pentagonalLength , 'PentagonalLength' )
9090 isNumber ( pentagonalBaseLength , 'PentagonalBaseLength' )
9191 isNumber ( height , 'Height' )
92- return ( 5 / 2 * pentagonalLength * pentagonalBaseLength * height )
92+ return ( 5 / 2 * pentagonalLength * pentagonalBaseLength * height )
9393}
9494
9595/*
@@ -99,7 +99,7 @@ const volPentagonalPrism = (pentagonalLength, pentagonalBaseLength, height) => {
9999*/
100100const volSphere = ( radius ) => {
101101 isNumber ( radius , 'Radius' )
102- return ( 4 / 3 * Math . PI * radius ** 3 )
102+ return ( 4 / 3 * Math . PI * radius ** 3 )
103103}
104104
105105/*
@@ -109,7 +109,7 @@ const volSphere = (radius) => {
109109*/
110110const volHemisphere = ( radius ) => {
111111 isNumber ( radius , 'Radius' )
112- return ( 2.0 * Math . PI * radius ** 3 ) / 3.0
112+ return ( 2.0 * Math . PI * radius ** 3 ) / 3.0
113113}
114114
115115const isNumber = ( number , noName = 'number' ) => {
@@ -120,4 +120,4 @@ const isNumber = (number, noName = 'number') => {
120120 }
121121}
122122
123- export { volCuboid , volCube , volCone , volPyramid , volCylinder , volTriangularPrism , volPentagonalPrism , volSphere , volHemisphere }
123+ export { volCuboid , volCube , volCone , volPyramid , volCylinder , volTriangularPrism , volPentagonalPrism , volSphere , volHemisphere }
0 commit comments