Last active
December 28, 2015 08:19
-
-
Save justuseapen/7470442 to your computer and use it in GitHub Desktop.
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
LIGHT = 5.00 | |
MEDIUM = 7.50 | |
BOLD = 9.75 | |
def coffee_selection | |
puts "How many packs of LIGHT would the customer like?" | |
light_total = LIGHT*gets.chomp.to_f | |
puts "How many packs of MEDIUM would the customer like?" | |
medium_total = MEDIUM*gets.chomp.to_f | |
puts "How many packs of BOLD would the customer like?" | |
bold_total = BOLD*gets.chomp.to_f | |
amount_due = light_total + medium_total + bold_total | |
puts "The total amount due is $#{"%.2f" % amount_due}." | |
puts "How much money has the customer given you?" | |
cash_rendered = gets.chomp.to_f | |
if cash_rendered < amount_due | |
puts "That is not enough money!" | |
else | |
change = cash_rendered - amount_due | |
change_time = Time.now.strftime("%I:%M%P %B %d %Y") | |
puts "You owe the customer $#{"%.2f" % change} in change at #{change_time}" | |
end | |
end | |
coffee_selection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment