# William M. Farmer

# 11 October 2010

# Student number: #######

# macid: xxxxxxx

#

# This is a solution for Major Assignment 1 (Lab 04) Version 16.



import math



print """\



This program is a solution to Major Assignment 1 (Lab 04) Version 16.

"""



r = input("Enter the radius of a sphere (in any units): ")

print ""



a = (4.0/3.0) * math.pi * pow(r,3)

print "The volume of the sphere with radius r is = ", a



b = (4.0/3.0) * math.pi * pow(2 * r,3)

print "The volume of the sphere with radius 2 * r is = ", b



c = 100 * abs(a - b) / b

print "The relative difference between these values is = ", c

print ""





# 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 more likely satisfy its requirements.

# 

# 

# Test Plan

# Test 1:

# Input: [0]

# Expected Output: [0, 0, Error: Division by zero]

#

# Test 2:

# Input: [.5]

# Expected Output: [0.5236, 4.1888, 87.5]

#

# Test 3:

# Input: [1]

# Expected Output: [4.1888, 33.5103, 87.5]

#

# Test 4:

# Input: [string]

# Expected Output: [error - NameError]

