Question

Topics covered: Using variables e Arithmetic operators Printing output Manipulating string objects . Generating random number
Manipulating string objects Generating random numbers e . Getting user input NOTE: Each of your iles must include a doestring

python
0 0
Add a comment Improve this question Transcribed image text
Answer #1

##################################
## Question:
###################################
## Output:
##               $ python DanyCsa1q1.py
#                $##################################################
#                $             Regular Dodecahedron    
#                $       Surface Area and Volume Calculator   
#                $##################################################
#                $
#                $
#                $Edge Length : 2
#                $
#                $
#                $Surface Area: 82.582
#                $Volume: 61.0
#                $
######################################
# import the math module
import math

def round3(number):
     multiplier = 1000
     return math.floor(number * multiplier) / multiplier

#   Printing banner . you can remove \t to avoid a compulsary gap before each line
print("##################################################\n             Regular Dodecahedron      \n       Surface Area and Volume Calculator     \n##################################################\n")

length = input("\nEdge Length : ")
print("\n")
val = int(length)
if val >= 0:
     surface1 = 3*math.sqrt(25 + (10 *math.sqrt(5))) * val * val
     surface2 = round3(surface1)
     volume1 = (3.75 + ( 1.75 * math.sqrt(5)))* val * val * val
     volume2 = round( volume1)
     print "Surface Area: ",surface2
     print "Volume: ",volume2
else:
     print("\n\t give non negative length of your dodecahedron")

Add a comment
Know the answer?
Add Answer to:
python Topics covered: Using variables e Arithmetic operators Printing output Manipulating string objects . Generating random...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use Java program Material Covered : Loops & Methods Question 1: Write a program to calculate...

    Use Java program Material Covered : Loops & Methods Question 1: Write a program to calculate rectangle area. Some requirements: 1. User Scanner to collect user input for length & width 2. The formula is area = length * width 3. You must implement methods getLength, getWidth, getArea and displayData ▪ getLength – This method should ask the user to enter the rectangle’s length and then return that value as a double ▪ getWidth – This method should ask the...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  • Part 1: Use principles of inheritance to write code calculating the area, surface area, and volume...

    Part 1: Use principles of inheritance to write code calculating the area, surface area, and volume of rectangular objects. First, write an abstract super class RectangularShape, then write a subclass Rectangle that inherits from the super class to compute areas of rectangles, including squares if there is only one data. Finally, write another subclass Cuboid that inherits from its super class Rectangle above to compute surface areas and volumes of cuboids, including 3 equal sided cube. Must apply code-reusability in...

  • This is a java file and I am very confused on how to do this project!...

    This is a java file and I am very confused on how to do this project! please help!! Specifications Overview: You will write a program this week that is composed of three classes: the first class defines Ellipsoid objects, the second class defines EllipsoidList objects, and the third, Ellipsoid ListApp, reads in a file name entered by the user then reads the list name and Ellipsoid data from the file, creates Ellipsoid objects and stores them in an ArrayList of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT