if I take joe ( the sales person) This code should work right?? whats 
wrong here?
require 'csv'

    puts "Hi, are you a current customer? (y/n) "
    answer = gets.chomp.downcase
    if answer == "y"
      sell_to_customer
    elsif answer == "n"
      register_new_customer
    else
      raise "answer must be 'y' or 'n'"
    end


def register_new_customer ( customer_id, fname, lname, address1, 
address2, city, state, zip, ph_no)

  puts "Enter first name please"
  fname = gets.chomp
  puts "Enter last name please"
  lname = gets.chomp
  puts "Enter your street address please"
  address1= gets.chomp
  puts "Enter your House no./Apt no."
  address2= gets.chomp
  puts "Enter the City"
  city = gets.chomp
  puts "Enter the State"
  state = gets.chomp
  puts "Enter your Zip code"
  zip = gets.chomp
  puts "Enter your Phone Number"
  ph_no = gets.chomp
  puts "Thank you very much"

#getting the customer data in the file
CSV.open("customer.csv", "a") do |csv|
#csv << ["First_Name", "Last_Name", "Address_1", "City" , "Zip" , 
"Ph_No"]
csv << [fname, lname, address1, address2, city, state, zip, ph_no]


end
end



and then irrespective of them being new or old once they register, I 
want them to go to this method

#calculating shipping and tax
def calculate_the total
  sub_total=0
  tax = 0
  shipping = 0

  puts "Your Sub total is"
  CSV.foreach("Shopping_list.csv", "r") do |row|
  sub_total= {for |x| do  sub_total + row[4]}


  puts "Enter your zip code"
  zip = gets.chomp

  CSV.foreach("zipcode.csv") do |row|
  if zipcode == row[0]

  shipping = row[1]

  end
  end

-- 
Posted via http://www.ruby-forum.com/.