I'm trying to run this code below:
class ProdutItem
attr_reader :price_unit, :x_item, :price_promo
def initialize(price_unit: , x_item: 1, price_promo: price_unit)
@price_unit = price_unit
@x_item = x_item
@price_promo = price_promo
end
def price_qtde(units)
units_promo = units / @x_item
units_eo = units % @x_item
@price_promo * units_promo + @price_unit * units_eo
end
end
rules = ProdutItem.new(price_unit: 50, x_item: 3, price_promo: 130)
puts rules.price_qtde
But this error is showing below:
Checkout.rb:11:in 'price_qtde': wrong number of arguments (given 0, expected 1) (ArgumentError)