I just started learning Ruby a few weeks ago and tried to make a credit
card payment calculator today to practice but I'm getting an error
message: 'calc_payment': undefined local variable or method 'payment'
for main:Object (NameError)
Could someone help me out? As I see it, I defined all the variables so I
don't understand why I'm getting the error message.
On 12 October 2013 15:19, Greg Hajdu <lists@ruby-forum.com> wrote:
I just started learning Ruby a few weeks ago and tried to make a credit
card payment calculator today to practice but I'm getting an error
message: 'calc_payment': undefined local variable or method 'payment'
for main:Object (NameError)
Could someone help me out? As I see it, I defined all the variables so I
don't understand why I'm getting the error message.
Thank you for your help!
I modified it and also noticed the problem with the formula.
So this is what I got. It looks like it works, I think there are only
problems with the calculator part. Somehow the results aren't the same
as some online calculators. But as long as the code works, I'm happy.
Thank you for your help!
I modified it and also noticed the problem with the formula.
So this is what I got. It looks like it works, I think there are only
problems with the calculator part. Somehow the results aren't the same
as some online calculators. But as long as the code works, I'm happy.
Differences might be caused by integer division (just a guess without
going through the calculation in detail):