Skip to content

Instantly share code, notes, and snippets.

@eveadele
eveadele / meancoffeeshop
Created February 18, 2014 18:50
Cash Register 1 - Eve and Jake
puts "Welcome to the mean coffeeshop. What is the amount due?"
amount_due = gets.chomp.to_f
puts "What is the amount tendered?"
amount_tendered = gets.chomp.to_f
if amount_tendered < amount_due
puts "You owe me an additional $#{format("%.2f", amount_due - amount_tendered)} or I will break your kneecaps."
else
puts "===Thank You!==="
puts "The total change due is $#{format("%.2f", amount_tendered - amount_due)}"
puts "Transaction completed on " + Time.now.strftime("%m/%d/%Y %I:%M%p")