On Mon, Feb 25, 2008 at 3:18 PM, Christian Rubio
<chris.rubio.osv / fedex.com> wrote:
> Help I am completely new to ruby and to OO programming. Why-does my code
>  not compile??
>
>  class Quadratic
>
>     def findroots()
>         b = (ARGV[0])
>         c = (ARGV[1])
>         $stdout.print("You entered " , ARGV[1], ARGV[0], "\n")
>         discriminant = b * b - 4.0 * c
>         sqroot =  Math.sqrt(discriminant)
>
>         root1 = (-b + sqroot) / 2.0
>         root2 = (-b - sqroot) / 2.0
>
>         $stdout.print(root1)
>         $stdout.print(root2)
>     end
>
>  end
>
>  if __FILE__ == $0
>         qf = Quadratic.new
>         qf.findroots
>  end

Hi,

First, please, next time post the exact error message. You'll save
people that want to help you some investigation.

If the folowing message is similar to your error:
W:/var/x.rb:7:in `*': can't convert String into Integer (TypeError)
	from W:/var/x.rb:7:in `findroots'
	from W:/var/x.rb:21

then you're trying to multiply numbers by strings.
Replace
>         b = (ARGV[0])
>         c = (ARGV[1])
by
         b = ARGV[0].to_f
         c = ARGV[1].to_f
to_f will convert string to float. For more info, read the docs of
String#to_f and possibly the whole String class
(e.g. using RI or http://ruby-doc.org/core/)

If the message is different, please post it and will see.

Jano