Created
August 12, 2014 16:58
-
-
Save alacritythief/47e38dbe815250340554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "What is the amount due?" | |
amt_due = gets.to_f | |
puts "What is the amount tendered?" | |
amt_tnd = gets.to_f | |
if amt_tnd == amt_due | |
puts "========== Thank You! ============" | |
puts Time.now.strftime("%m/%d/%Y %l:%M") | |
puts "==================================" | |
else | |
change = amt_tnd - amt_due | |
tender = sprintf('%.2f', change.abs) | |
if change > 0 | |
puts "========== Thank You! ============" | |
puts "The total change due is $#{tender}" | |
puts Time.now.strftime("%m/%d/%Y %l:%M") | |
puts "==================================" | |
else | |
puts "===================================================" | |
puts "WARNING: Customer still owes $#{tender}! Exiting..." | |
puts "===================================================" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment