Created
February 18, 2014 19:19
-
-
Save adeng21/9077926 to your computer and use it in GitHub Desktop.
Cash Register Challenge 1
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?" | |
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