Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2013 15:41
Show Gist options
  • Save anonymous/5743983 to your computer and use it in GitHub Desktop.
Save anonymous/5743983 to your computer and use it in GitHub Desktop.
# Savings 0.01
print "How much is your initial deposit?"
initialDeposit = gets.chomp.to_i
montlhyDeposit = 3500
interest = 1.028
interestMonthly = 1.014
savings = (initialDeposit * interest) + ((12*montlhyDeposit) * interestMonthly)
puts "Savings after year 1: %.0f Which is a annual interest income of %.0f" % [savings, savings - initialDeposit - montlhyDeposit*12]
yearTwo = (savings * interest) + ((12*montlhyDeposit) * interestMonthly)
puts "Savings after year 2: %.0f Which is a annual interest income of %.0f" % [yearTwo, yearTwo - savings - montlhyDeposit*12]
yearThree = (yearTwo * interest) + ((12*montlhyDeposit) * interestMonthly)
puts "Savings after year 3: %.0f Which is a annual interest income of %.0f" % [yearThree, yearThree - yearTwo - montlhyDeposit*12]
yearFour = (yearThree * interest) + ((12*montlhyDeposit * interestMonthly))
puts "Savings after year 4: %.0f Which is a annual interest income of %.0f" % [yearFour, yearFour - yearThree - montlhyDeposit*12]
yearFive = (yearFour * interest) + ((12*montlhyDeposit * interestMonthly))
puts "Savings after year 5: %.0f Which is a annual interest income of %.0f" % [yearFive, yearFive - yearFour - montlhyDeposit*12]
yearSix = (yearFive * interest) + ((12*montlhyDeposit * interestMonthly))
puts "Savings after year 6: %.0f Which is a annual interest income of %.0f" % [yearSix, yearSix - yearFive - montlhyDeposit*12]
yearSeven = (yearSix * interest) + ((12*montlhyDeposit * interestMonthly))
puts "Savings after year 7: %0.f Which is a annual interest income of %.0f" % [yearSeven, yearSeven - yearSix - montlhyDeposit*12]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment