Skip to content

Instantly share code, notes, and snippets.

@foglabs
Created August 12, 2014 17:12
Show Gist options
  • Save foglabs/ecd8e6e34f6165d8d289 to your computer and use it in GitHub Desktop.
Save foglabs/ecd8e6e34f6165d8d289 to your computer and use it in GitHub Desktop.
Cash Register I
price = 0
cash = 0
time = Time.now
puts "Please enter the amount due: "
price = gets.chomp.to_f
puts "Please enter the cash tendered: "
cash = gets.chomp.to_f
if price > cash
puts "\n\nThat's not gonna cut it! You're short by $#{'%.2f' %(price-cash)}."
else
puts "\n\nYour change is $#{'%.2f' %(cash-price)}\n\n===========\nThanks yo!\n===========\n#{time.hour}:#{time.min} #{time.month}-#{time.day}-#{time.year}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment