FINAL_PROJECT (Compound Interest)

You are currently viewing a revision titled "Final project", saved on May 25, 2013 at 1:34 pm by Anne Menmou
Title
Final project
Content
# FINAL PROJECT # The program ask for a user to enter the initial amount in a saving account, #the interest rate, the nomber of years and the time interest if applicable. # function to calculate total amount in the saving acount def cal_saving_amount(p, r, t, n): import math if n==0: r=r/100 # the three following statements are to calculate the total amount if the interest is compound continously i.e Many times over the year amount=math.e amount=p*(amount**(r*t)) else: r=r/100 # the two following statements are to calculate the total amount if the interest is compound n time per year amount=p*((1+(r/n))**(n*t)) return amount # PROCESSING STAGE choice='y' while choice =='y': # enter  the initial amount, the interest rate, the number of year and the interest period if applicable init_amount=float(input('Please enter the initial amount dollars in the saving account : ')) int_rate=float(input('Please enter the interest rate percentage: ')) nbe_year=float(input('Please enter the number of year :')) compound_choice=input('Continuously compound (y/n)? ') if compound_choice=='n': print('How many time the interest is compound per year?)') time_period=float(input('Please enter the interst period : ' )) elif compound_choice=='y': time_period=0.0 else: break total_amount=cal_saving_amount(init_amount, int_rate,nbe_year, time_period) print('') print('THE TOTAL AMOUNT IN THE SAVING ACCOUNT AFTER ',nbe_year, ' YEAR(S)INVESTMENT IS : ',total_amount) print('  ') choice=input('DO you want to calculate again ? ((y/n)' )# If the user answer "y" the program ask for inputs again. print("GOOD BYE!!!!!!!")
Excerpt
Footnotes


Old New Date Created Author Actions
May 25, 2013 at 5:34 pm Anne Menmou