Values mix up

J

Jake Steve

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
 
B

Brian Candler

Jake said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,825
Members
47,371
Latest member
Brkaa

Latest Threads

Top