well first I started programing with vb6. I became good at it. but I wanted to start with something solid and little easy. so I went for Ruby(ruby in steel)

i did this thing on ruby for tax rate calculation using this code
taxrate = 0.17
LBP = 1.5
print "Enter object price:"
s = gets
subtotal = s.to_f
if (subtotal <0.0) then
    subtotal = 0.0
end
tax = subtotal * taxrate 
puts "tax on object is 17% => Tax on $#{subtotal} is $#{tax}, so grand total is $#{subtotal+tax}"
tax = (subtotal+tax) * LBP
puts "it will cost #{tax} in LBP"
doing this on ruby is easier than VB6 but there is something that confused me that is doing objects on ruby.
according to the tutorial I'm taking i did an cat and dog objects making them bark and miaow using this code
class Dog

    def set_name( aName )
        @myname = aName
    end
    
    def get_name
        return @myname
    end
    
    def talk
        return 'woof!'
    end
end

class Cat
    
    def set_name( aName )
        @myname = aName
    end
    
    def get_name
        return @myname
    end
    
    def talk
        return 'miaow!'
    end
end


mydog = Dog.new
yourdog = Dog.new
mycat = Cat.new
yourcat = Cat.new
someotherdog = Dog.new

mydog.set_name( 'Fido' )
yourdog.set_name( 'Bonzo' )
mycat.set_name( 'Tiddles' )
yourcat.set_name( 'Flossy' )


puts(mydog.get_name)
puts(yourdog.get_name)

puts(someotherdog.get_name)

puts(mycat.get_name)
puts(yourcat.get_name)

puts(mydog.talk)
puts(yourdog.talk)
puts(mycat.talk)
puts(yourcat.talk)
but all is given to me is text. i can get the same result if i just made them a text using puts or print, while in vb6 i can draw a dog and put the cat and make them bark or miaow by clicking on them or something. so i didn't really know what the purpose of using all this code to make object that gives me only writings. I mean where is the object? can someone explain or something?
and thanks.
There are two things going on here.

One is Ruby — a programming language.
The other is "Ruby in Steel" — a framework for Visual Studio that lets you create a graphical user interface, or the buttons and windows that you are looking for.

The Ruby code you showed doesn't have anything to do with Ruby in Steel. I am not at all familiar with Ruby in Steel, but you should probably just look for some tutorials on that specifically, and once you have your user interface working you can put in your ruby code for the tax calculation.

This was on the first Google search page for Ruby in Steel:

http://www.youtube.com/watch?v=mHWTVNq3A0Y

Good luck!
ballouta wrotebut all is given to me is text. i can get the same result if i just made them a text using puts or print, while in vb6 i can draw a dog and put the cat and make them bark or miaow by clicking on them or something. so i didn't really know what the purpose of using all this code to make object that gives me only writings. I mean where is the object? can someone explain or something?
and thanks.
Ballouta, very interesting question. What you are asking is not limited to Ruby. You want to know more about Object Oriented Programming. We call it OOP.

Now I'm not going to give you a tutorial about OOP, you should continue with the one you started. However here are some tips:

- OOP is not restricted to one language. It is a programming paradigm that is implemented in many other languages like C++, Java, C#, Python, Smalltalk, etc.

- There is (virtually) nothing you can do in OOP that you cannot do in other paradigms. What you have done in VB6 for instance, is called the procedural or sometimes called imperative paradigm. Each paradigm has its strengths and weaknesses.

- The main strength of OOP, is that the code is much more organized than procedural code. You won't notice this for a small program like "Cats & Dogs", but when the program becomes larger it becomes very necessary to put order in your code. OOP is perfect for this.

- The main weakness of OOP (compared to procedural) is a slight loss in performance. Note that it doesn't mean that OOP is slow, or that Ruby is not powerful. This is wrong. What it means is that OOP comes at a slight cost of execution time and memory. However, modern computers are so powerful you won't even feel a difference.


There you go. OOP might seem useless at first. It took me some time to understand its real power. If you ask the developers in this forum, they will all agree that OOP gives you means of managing large code like never before.
the objects are the ones you created when you used the word new
in OOP you instantiate (create an instance) of a class by using the keyword new and create the objects of the class ; which here are mydog , yourdog, yourcat ..

a class is like a container for a group of objects describing their properties and behaviors.

once you delve more into OOP you'll know that for the example you gave .. you can have a main Class called Animals in which you'll have seperate classes for each animal.

you'll hear about inheritance in which the main class will contain all the similar properties and behaviors that all animals share (color, name, ..)

and each sub class will have the distinct properties and behaviors for each animal. (a cat myaws a dog barks etc..)