Skip to content

Instantly share code, notes, and snippets.

@defunkt
Forked from adeng21/Cash_Register_1
Last active October 8, 2020 13:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save defunkt/9077942 to your computer and use it in GitHub Desktop.
Save defunkt/9077942 to your computer and use it in GitHub Desktop.
puts "What is the amount due?"
total = gets.chomp.to_f
puts "What is the amount tendered?"
paid = gets.chomp.to_f
if paid < total
puts "WARNING: Customer still owes $#{format("%.2f", total-paid)}"
puts Time.now
elsif paid > total
puts "The total change due is $#{format("%.2f", paid-total)}"
puts Time.now
else
puts "Exact amount tendered. No change due"
puts Time.now
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment