Write a program to calculate the surface area and volume of a square pyramid. A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal. Length of the base: a Height of the pyramid: h Volume = a2h/3 Slant height, s = sqrt(h2 + (a/2)2) This is the Pythagorean Theorem part. Area of one pyramid side = s*a/2 Here are my calculations: Test Case #1 Height(h): 5.0’ Base(a): 2.5’ Volume = (2.5**2) * (5/3) (6.25) * (1.66) = 10.375 cubic feet Slant Height = math.sqrt(5**2) + (2.5/2)**2) Sqrt(25+1.5625) Sqrt(26.5625) = 5.154 feet Pyramid (not including base) = (5.154) * (2.5/2) * 4 (5.154) * (1.25) * (4) = 25.769 sq. Ft. I have attached a screenshot of my program I have so far. When I run the program, the output doesn't match what I have for the surface area and volume, am I missing something?
Write a
A square pyramid has a base that is square and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal.
Length of the base: a
Height of the pyramid: h
Volume = a2h/3
Slant height, s = sqrt(h2 + (a/2)2) This is the
Pythagorean Theorem part.
Area of one pyramid side = s*a/2
Here are my calculations:
Test Case #1 Height(h): 5.0’ Base(a): 2.5’
Volume = (2.5**2) * (5/3)
(6.25) * (1.66) = 10.375 cubic feet
Slant Height = math.sqrt(5**2) + (2.5/2)**2)
Sqrt(25+1.5625)
Sqrt(26.5625) = 5.154 feet
Pyramid (not including base) = (5.154) * (2.5/2) * 4
(5.154) * (1.25) * (4) = 25.769 sq. Ft.
I have attached a screenshot of my program I have so far. When I run the program, the output doesn't match what I have for the surface area and volume, am I missing something?
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images