Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cash Register Challenge 1
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