Values mix up

Hi I’m just starting to use ruby and I’m stuck on a homework assignment
for class
My problem is
dollars = tempEntry.text.to_f

rate = tempEntry.text.to_f

time = tempEntry.text.to_f

fv = dollars*(1+rate)**time

output= " In " + time.to_s + " years your investment will be worth " +
fv.to_s

resultLabel.set_label( output )

the dollars value takes the time values place
if anyone could help i would really appreciate it

Jake Alucard wrote:

Hi I’m just starting to use ruby and I’m stuck on a homework assignment
for class
My problem is
dollars = tempEntry.text.to_f

rate = tempEntry.text.to_f

time = tempEntry.text.to_f

fv = dollars*(1+rate)**time

output= " In " + time.to_s + " years your investment will be worth " +
fv.to_s

resultLabel.set_label( output )

That’s not a problem; it’s an incomplete piece of code. (We have no idea
what tempEntry is, for example)

A problem might be “it produces the value 8 when I expected it to
produce the value 5”, or “it raises the following exception …” with a
complete copy-paste of the exception.

I think you’re trying to say something with “the dollars value takes the
time values place”, but what that means, I have no idea.

For advice on how to write questions which are more likely to get a
helpful answer, read
http://www.catb.org/~esr/faqs/smart-questions.html#intro

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs