# Sublime calculation program

print "Welcome to the Sublime calculation program"
print "---------------------------------------"
print

# Print out the menu:
print "Please select a function:"
print "1  Area of a Rectangle"
print "2  Area of a Square"
print "3  Area of a Triangle"
print "4  Area of a Circle"
print "5  Pythagoras' Therom (Distance Between Two Points"
print "6  Natural Logarithm of a Number"

# Get the user's choice:
option = input("> ")

# Calculate the area:
import math

if option == 1:
        height = input("Please enter the height: ")
        width = input("Please enter the width: ")
        area = height*width
        print "The area is", area
        
elif option == 2:
        side = input("Please Enter the length of the side: ")
        area = side**2
        print "The area is", area
        
elif option == 3:
        a = input("Please enter the length of a side: ")
        b = input("Please enter the length of another side: ")
        degrees = input("Please enter the size of angle inlcuded by the above sides in degrees: ")
        C = degrees*(math.pi/180)
        area = 0.5*a*b*math.sin(C)
        print "The area is", area

elif option == 4:
        radius = input("Please enter the radius: ")
        area = 3.14*(radius**2)
        print "The area is", area

elif option == 5:
        x1 = input("Please enter the x co-ord of the first point: ")
        y1 = input("Please enter the y co-ord of the first point: ")
        x2 = input("Please enter the x co-ord of the second point: ")
        y2 = input("Please enter the y co-ord of the second point: ")
        dx = x2 - x1 
        dy = y2 - y1 
        dsquared = dx**2 + dy**2 
        result = math.sqrt(dsquared) 
        print "The distance between (x1,y1) and (x2,y2) is", result
        
else:
        x = input("Please enter number to find the logarithm of: ")
        if x <= 0: 
            print "Positive numbers only, please." 
        else: 
            print "The natural logarithm of", x, "is", math.log(x)
