# Ryan Martin
# macid: abcd123
# student number: #######
# July 12, 2011
#
# This is a solution for Marked Assignment 1 (Lab 03) on Wednesday.

import math

def main():

    print """\

This program is a solution to Marked Assignment 1 (Lab 03) on Wednesday.

"""

    #INPUTS
    rho = input("Enter a value for the density, rho: ")
    E = input("Enter a value for the modulus of elasticity, E: ")
    R = input("Enter a value for the radius, R: ")
    print 

    GRAVITY = 9.81
    BE = 1.866

    #CALCULATION
    A = pow(( 9 * BE**2 * E * R**2 ) / ( 16 * rho * GRAVITY ),1.0/3.0)
    B = pow(( 9 * BE**2 * E * (2 * R)**2 ) / ( 16 * rho * GRAVITY ),1.0/3.0)
    C = 100.0 * abs((A - B) / B)

    #OUTPUT
    
    print "The critical height for rho, E and R, A=", A
    print "The critical height for rho, E and 2R, B=", B
    print "The relative difference between these values, C=", C
    print ""

main()


##Design Question
##
##The main advantage of coding the formula just once is that there
##will be just one piece of code to design, implement, test and
##maintain instead of two. As a result, the program will be simpler and
##will be more likey to satisfy its requirements.
##
##Testing Report
##
##Test: 1
##Input: [2400,3e10,2]
##Expected Output: [215.318957042,341.797538916,37.0039475053]
##Actual Output: [215.318957042,341.797538916,37.0039475053]
##Result: Pass
##
##Test: 2
##Input: [string,6.12e8,1.35]
##Expected Output: [Error]
##Actual Output: [NameError]
##Result: Pass
##
##Test: 3
##Input: [0,6.12e8,1.35]
##Expected Output: [Error]
##Actual Output: [ZeroDivisionError]
##Result: Pass
