Mahadev Ittina wrote:
[...]
> my @b = 280 and @h=300 from before.. when i try to multiply the weight
> it should come 2.1 but in this case it is 0.0032 or so.. 

Then obviously @b and @h are not being set correctly.

> which is
> wrong.. hence because of that my uls values are wrong and hence the
> entire following program.. i am pretty sure its problem with the
> variables.. just cant figure out where!

Well, what do your tests say?

BTW, your code is problematic.  Two tips:

* That's a pretty long method.  Refactor parts of it into shorter 
methods if possible.

* Never, never use Floats for arithmetic -- they're imprecise.  Use 
integers or BigDecimal.


Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org
-- 
Posted via http://www.ruby-forum.com/.