I would like the program receives as parameters the catidad volvo car
and demarcates the program calculate the cost plus impuesos (IGV) of the
desired amount of cars.
I tried to modify the program to try to introduce a "for" to iterate the
program depending on how many cars you wish to calculate
class Auto
attr_accessor :auto
def initialize(auto)
@modelo = modelo
@precio = precio
end
def calcular_neto(i)
for i in 0 ..i
(auto)*0.18
end
return auto
end
auto = Auto.new("Volvo", 19000)
neto = auto.calcular_neto(2)
puts " Neto: #{neto}"
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/060dcc7d205e013ad8f16e3ec21240d9%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment