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?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

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?

 

ed
from math import sqrt
from math import ceil
from math import pow
name = input("Please enter your name: ")
#Get base from user
*
n
.py.py - /Users/tishenayazzie/Documents/.py.py (3.7.9)
CO
base = float(input("Please enter the base: "))
#Get height from user
height= float (input("Please enter the height:"))
Volume= ((base**2) *height/3)
Slant = sqrt(height**2+(base//2)**2)
Area= ((Slant*base//2))*4
print (f"Height: {height:.3f}")
print (f"Base: {base: .3f}")
print (f"Surface Area of Pyramid: {Area:.3f}")
print (f"Volume of Pyramid: {Volume:.3f}")
Ln: 16
Col: 0
Transcribed Image Text:ed from math import sqrt from math import ceil from math import pow name = input("Please enter your name: ") #Get base from user * n .py.py - /Users/tishenayazzie/Documents/.py.py (3.7.9) CO base = float(input("Please enter the base: ")) #Get height from user height= float (input("Please enter the height:")) Volume= ((base**2) *height/3) Slant = sqrt(height**2+(base//2)**2) Area= ((Slant*base//2))*4 print (f"Height: {height:.3f}") print (f"Base: {base: .3f}") print (f"Surface Area of Pyramid: {Area:.3f}") print (f"Volume of Pyramid: {Volume:.3f}") Ln: 16 Col: 0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY