Jython的摊销图贷款计算器?

时间:2015-11-12 17:06:56

标签: java python python-2.7 jython jes

我试图在JES Jython中做一个项目来计算房屋贷款的摊销图表。我附上了项目说明以及我根据我在网上发现的内容以及我的工作内容所做的工作。

Project Instructions

继承我的代码;

def main():
  itemName = raw_input('Enter the cost of the home: ')
  year = int(raw_input('Enter the initial down payment: '))
  cost = float(raw_input('Enter the period of the loan: '))
  life = int(raw_input('Enter estimated life of item (in years): '))
  method = raw_input('Enter the annual percentage rate (SL or DDB): ')
  printNow('Description: ' + itemName)
  printNow('Year of purcahse: ' + str(year))
  printNow('Cost: $ %.2f ' %(cost))
  printNow('Estimated life: ' + str(life) + ' years')
  printNow('Method of depreciation: ' + method)
if method == "SL":
 value = cost
 endOfYear = 0
 for i in range(year, year + life):
  if i == year + life -1:
    depreciation = value
  else:

    depreciation = value * 1.0 / life
  endOfYear += depreciation
  printNow('%d   %.2f  %.2f   %.2f' %(i,value,depreciation,endOfYear))
elif method == "DDB":
 value = cost
 endOfYear = 0
 for i in range(year, year + life):
  if i == year + life -1:
    depreciation = value
  else:

    depreciation = value * 2.0 / life
  endOfYear += depreciation
  printNow('%d   %.2f  %.2f   %.2f' %(i,value,depreciation,endOfYear))
  value -= depreciation

main()的

0 个答案:

没有答案