Last active
August 29, 2015 13:56
-
-
Save dgreenbe77/9074781 to your computer and use it in GitHub Desktop.
Cashier.rb
This file contains hidden or 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?" | |
| amount_due = gets.chomp.to_f | |
| puts "What is the amount tendered?" | |
| tendered = gets.chomp.to_f | |
| total = tendered - amount_due | |
| new_total = sprintf('%.2f', -total) | |
| other_total = sprintf('%.2f', total) | |
| @time = Time.new.strftime("%D %H:%M") | |
| if total < 0 | |
| puts "WARNING CUSTOMER OWES YOU $#{new_total} MORE SCRILLA!" | |
| else | |
| puts "Thank You!" | |
| puts "The total change due is $#{other_total}" | |
| puts @time | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment