Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created February 28, 2020 00:11
Show Gist options
  • Save harrisonmalone/f89a030b4ab501e8bcda90cb43d9137c to your computer and use it in GitHub Desktop.
Save harrisonmalone/f89a030b4ab501e8bcda90cb43d9137c to your computer and use it in GitHub Desktop.
# you are working at a bar where you have a current backlog of drinks to make:
# 3 party parrot cocktails
# 2 party parrot waters
# and
# 6 party parrot beers
# write a program that asks the customer for their order, you'll need to research the method gets to do this https://duckduckgo.com/?t=ffab&q=gets+ruby&ia=web
# if they order a party parrot cocktail, add one to the number of party parrot cocktails you need to make,
# if they order a party parrot water, add one to the number of party parrot waters you need to make,
# if they order a party parrot beer, add one to the number of party parrot beers you need to pour
# print the final drinks order so you know what to make
# cocktails sell for $22, and cost $8 to make
# beer sell for $12, and cost $3 to pour
# water sell for $6, and cost $0.15 to make
# print out the total profit for the orders you have
puts "welcome to the parrot bar"
puts "What drink would you like"
puts "1 for cocktail"
puts "2 for water"
puts "3 for beer"
selection = gets.chomp.to_i
cocktail = 3
water = 2
beer = 6
profit_beer = 9
profit_cocktail = 14
profit_water = 5.85
if selection == 1
puts "you have selected a cocktail"
cocktail = cocktail + 1
elsif selection == 2
puts "You have selected a water"
water = water + 1
elsif selection == 3
puts 'You have selected a beer'
beer = beer + 1
end
# puts "Total cocktail : "
# puts "Total water : "
# puts "Total beer : "
total_profit = (profit_beer * beer) + (profit_cocktail * cocktail) + (profit_water * water)
puts "the total profit will be $#{total_profit}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment