Mortgage Calculator

Mortgage Calculator


I recently began house shopping. Being a first-time home buyer, the task seemed daunting, especially when I considered the financing options. So, I decided to write a script to help me get a handle on mortgage rates—at least this way, I could estimate my monthly payments. Even though Ruby didn't solve all of the issues related to buying a home, this script helped me get a handle on my financing options.

The Code

 print "Enter Loan amount: "
 loan = gets.chomp.to_i
 print "Enter length of time in months: "
 time = gets.chomp.to_i
 print "Enter interest rate: "
 rate = gets.chomp.to_f/100

 i = (1+rate/12)**(12/12)-1 ...

Get Wicked Cool Ruby Scripts now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.