#prompt the user to enter the price
puts "Enter the sale price "
price = gets.chomp
total = 0
while price != "done"
price = price.to_f
total = total + price
puts "subtotal : $#{total}"
puts "Enter the sale price"
price = gets.chomp
end
puts "The amount due is: $#{total}"
amount_due = total
#Enter the amount tendered
puts "Enter amount tendered >> "
amount_tend = gets.chomp.to_f
# calculate and output the change due
change_due = amount_tend - amount_due
# check if the amount from user is not less than the amount due,
#if it is display the amount due and quit the program.
if amount_tend < amount_due
amount_due = amount_due - amount_tend
puts "You still owe me $#{amount_due}"
#diplay message and total change after due amount is paid off.
else
puts "========Thank You!===============!"
puts "The total change due is $#{change_due}"
puts ""
puts Time.now.strftime("%H:%M%p %m/%d/%Y")
puts "=================================="
end