Skip to content

Instantly share code, notes, and snippets.

@akcrono
Created August 12, 2014 17:32
Show Gist options
  • Save akcrono/68aa49e12d88e073acb0 to your computer and use it in GitHub Desktop.
Save akcrono/68aa49e12d88e073acb0 to your computer and use it in GitHub Desktop.
register for launch academy day 2
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