Created
August 12, 2014 17:32
-
-
Save akcrono/68aa49e12d88e073acb0 to your computer and use it in GitHub Desktop.
register for launch academy day 2
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
require 'bigdecimal' | |
require 'bigdecimal/util' | |
puts 'What is the amount due?' | |
total = gets.chomp.to_f | |
puts 'What is the amount tendered?' | |
cash = gets.chomp.to_f | |
if total > cash | |
puts 'WARNING: Customer still owes $0.50! Exiting...' | |
exit | |
end | |
puts '===Thank You!===' | |
puts sprintf("%.2f", cash) | |
puts "The total change due is #{sprintf("%.2f", (cash - total))}" | |
puts | |
puts "#{Time.new.strftime('%m/%d/%Y %l:%M%p')}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment