def sl(val,n):
deprec=val/n
print "in ",n
for year in range(1,n+1):
val=val-deprec
writeoutput(year,deprec,val)
return
def ddb(val,n):
for year in range(1,n+1):
deprec=2*val/n
val=val-deprec
writeoutput(year,deprec,val)
return
def syd(val,n):
tag=val
for year in range(1,n+1):
deprec=(n-year+1)*tag/(n*(n+1)/2)
val=val-deprec
writeoutput(year,deprec,val)
return
def writeoutput(year,depreciation,value):
print "End of the year %2d Depreciation: %7.2f Current Value: %8.2f" %(year,depreciation,value)
return
def main(choice,val,n):
print "Original value : ",val
val=float(val)
print "Number of years : ",n
if choice==1:
print "Straight-Line Method\n\n"
sl(val,n)
elif choice==2:
print "Double-Declining-Balance Method \n\n"
ddb(val,n)
elif choice==3:
print "Sum-Of-The-Years'-Digits Method"
syd(val,n)
return
print "\n\nMethod: (1-SL 2-DDB 3-SYD)"
main(1,8000,10)
print "\n\nMethod: (1-SL 2-DDB 3-SYD)"
main(2,8000,10)
print "\n\nMethod: (1-SL 2-DDB 3-SYD)"
main(3,8000,10)
print "\n\nMethod: (1-SL 2-DDB 3-SYD)"
main(1,5000,4)