Created
September 23, 2018 12:25
-
-
Save harrisonmalone/cc71ed1ca39d0bb32cdaecb12ad43336 to your computer and use it in GitHub Desktop.
This file contains 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
cocktails = 3 | |
waters = 2 | |
beers = 6 | |
puts "what would you like to order" | |
order = gets.chomp | |
if order == "cocktail" | |
cocktails += 1 | |
elsif order == "water" | |
waters += 1 | |
elsif order == "beer" | |
beers += 1 | |
else | |
puts "wrong order try again..." | |
end | |
p "you have #{cocktails} cocktails, #{waters} waters and #{beers} beers" | |
cocktail_money = cocktails * 2200 | |
beer_money = beers * 1200 | |
water_money = waters * 600 | |
cocktail_profit = cocktails * 800 - cocktail_money | |
beer_profit = beers * 300 - beer_money | |
water_profit = waters * 15 - water_money | |
total_profit = cocktail_profit + beer_profit + water_profit | |
"the total profit for the pub from these orders is #{total_profit}" | |
# a simple example that adds up total cost of drinks | |
# changes based on what is ordered |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment