The goal of this assignment is to ask the user for the price of each of

their items and print out a receipt using your own defined methods. I’ve

been doing well in the class(ahead actually) until the last two weeks

and I want to stay ahead.

This is what I have so far…

puts “Enter shopping cart item prices, one per line.\n”

puts “Press 0 when you are finished.\n”

items_in_cart = []

subtotal_cart = 0.0

subtotal_tax = 0.0

total_cost = 0.0

SALES_TAX = 0.07

def get_items_from_user()

items = []

item = ask_user_for_number(“Enter item price:”)

while (item != 0.0) do

items.push(item)

```
item = ask_user_for_number("Enter item price:")
```

end

return items

end

def ask_user_for_number(question_to_ask)

puts question_to_ask

response = gets().chomp().to_f()

end

def get_subtotal(cart_items)

subtotal = 0.0

cart_items.each() do |item|

subtotal = subtotal + item

end

return subtotal

end

def calculate_tax (cart_total)

return cart_total * SALES_TAX

end

puts get_items_from_user

puts ask_user_for_number

puts get_subtotal

puts calculate_tax

puts "Item subtotal: " + subtotal_cart.to_s()

puts "Sales Tax: " + subtotal_tax.to_s()

puts "Total: " + total_cost.to_s()

I keep getting this error

rb:43 in ‘ask_user_for_number’ : wrong number of arguments (0 for 1)

(Argument Error)

I have no idea what this means…and I don’t see what’s wrong in the

‘ask_user_for_number’ method so, I don’t even know where to begin to fix

it.

Thanks in advance for any help.